Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Do not use loadstring to load autorun (who even wrote this?). Also pr…
…int a message in case of successful autorun load
  • Loading branch information
mniip committed Mar 4, 2014
1 parent 64e1602 commit 4152bb5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lua/LuaScriptInterface.cpp
Expand Up @@ -334,9 +334,14 @@ tpt.partsdata = nil");

void LuaScriptInterface::Init()
{
if(Client::Ref().FileExists("autorun.lua"))
if(luacon_eval("dofile(\"autorun.lua\")"))
if(Client::Ref().FileExists("autorun.lua"))
{
lua_State *l = luacon_ci->l;
if(luaL_loadfile(l, "autorun.lua") || lua_pcall(l, 0, 0, 0))
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
else
luacon_ci->Log(CommandInterface::LogNotice, "Loaded autorun.lua");
}
}

void LuaScriptInterface::SetWindow(ui::Window * window)
Expand Down

0 comments on commit 4152bb5

Please sign in to comment.