From 4152bb560e2ec8d9a6d6c34357c60c4fce17e6e4 Mon Sep 17 00:00:00 2001 From: mniip Date: Tue, 4 Mar 2014 15:26:35 +0400 Subject: [PATCH] Do not use loadstring to load autorun (who even wrote this?). Also print a message in case of successful autorun load --- src/lua/LuaScriptInterface.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lua/LuaScriptInterface.cpp b/src/lua/LuaScriptInterface.cpp index 17116ce35..ed1b0b13f 100644 --- a/src/lua/LuaScriptInterface.cpp +++ b/src/lua/LuaScriptInterface.cpp @@ -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)