Skip to content

Commit

Permalink
Add luaL_loadbuffer hook
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnologicNick committed Oct 9, 2021
1 parent b8cb446 commit 6c236b9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions PluginDevFolder/SMLuaHook/hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ namespace LuaHook::Hooks {
{"name", &name}
};

for (LuaHook::hookItem& hookItem : LuaHook::HookConfig::getHookItems("luaL_loadbuffer")) {
for (LuaHook::selector& selector : hookItem.selector) {
bool selected = (*selector.func)(fields, hookItem, selector);
Console::log(selected ? Color::LightPurple : Color::Purple, selected ? "selected" : "not selected");
}
std::string input(buff, sz);

if (size_t executeCount = LuaHook::runLuaHook("luaL_loadbuffer", &input, fields)) {
Console::log(Color::Green, "Set contents to:\n%s", input.c_str());
return ((pluaL_loadbuffer)*hck_luaL_loadbuffer)(L, input.c_str(), input.size(), name);
}

return ((pluaL_loadbuffer)*hck_luaL_loadbuffer)(L, buff, sz, name);
Expand Down

0 comments on commit 6c236b9

Please sign in to comment.