Skip to content

Commit

Permalink
lets make that 1 billion
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Mar 4, 2021
1 parent 2f23a1e commit e04556e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/injected/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Say get_say()
}

void infinite_loop(lua_State* argst, lua_Debug * argdb) {
luaL_error(argst, "Reached the script execution amount.");
luaL_error(argst, "Hit Infinite Loop Detection of 1bln instructions");
};

Script::Script(std::string script, std::string file, bool enable)
Expand Down Expand Up @@ -685,6 +685,7 @@ bool Script::run(ImDrawList *dl)
return true;
if (changed)
{
result = "";
changed = false;
// Compile & Evaluate the script if the script is changed
try
Expand All @@ -706,6 +707,7 @@ bool Script::run(ImDrawList *dl)
lua["on_win"] = sol::lua_nil;
lua["on_screen"] = sol::lua_nil;
auto lua_result = lua.safe_script(code);
result = "OK";
}
catch (const sol::error &e)
{
Expand All @@ -716,7 +718,7 @@ bool Script::run(ImDrawList *dl)
try
{
lua_sethook(lua.lua_state(), NULL, 0, 0);
lua_sethook(lua.lua_state(), &infinite_loop, LUA_MASKCOUNT, 100000000);
lua_sethook(lua.lua_state(), &infinite_loop, LUA_MASKCOUNT, 1000000000);
drawlist = dl;
sol::optional<std::string> meta_name = lua["meta"]["name"];
sol::optional<std::string> meta_version = lua["meta"]["version"];
Expand Down

0 comments on commit e04556e

Please sign in to comment.