hedgewars/uScript.pas
changeset 13745 be265ab8a4fb
parent 13743 d7b72ea8d136
child 13750 110d6c1e817f
equal deleted inserted replaced
13744:4b79bac864be 13745:be265ab8a4fb
   112 procedure ScriptSetAmmoDelay(ammo : TAmmoType; delay: Byte); forward;
   112 procedure ScriptSetAmmoDelay(ammo : TAmmoType; delay: Byte); forward;
   113 
   113 
   114 var LuaDebugInfo: lua_Debug;
   114 var LuaDebugInfo: lua_Debug;
   115 
   115 
   116 procedure SetGlobals; forward;
   116 procedure SetGlobals; forward;
       
   117 procedure GetGlobals; forward;
   117 procedure LuaParseString(s: shortString);
   118 procedure LuaParseString(s: shortString);
   118 begin
   119 begin
   119     SetGlobals;
   120     SetGlobals;
   120     AddFileLog('[Lua] input string: ' + s);
   121     AddFileLog('[Lua] input string: ' + s);
   121     AddChatString(#3 + '[Lua] > ' + s);
   122     AddChatString(#3 + '[Lua] > ' + s);
   122     if luaL_dostring(luaState, Str2PChar(s)) <> 0 then
   123     if luaL_dostring(luaState, Str2PChar(s)) <> 0 then
   123         begin
   124         begin
   124         AddFileLog('[Lua] input string parsing error!');
   125         AddFileLog('[Lua] input string parsing error!');
   125         AddChatString(#5 + '[Lua] Error while parsing!');
   126         AddChatString(#5 + '[Lua] Error while parsing!');
   126         end;
   127         end
       
   128     else
       
   129         GetGlobals();
   127 end;
   130 end;
   128 
   131 
   129 function LuaUpdateDebugInfo(): Boolean;
   132 function LuaUpdateDebugInfo(): Boolean;
   130 begin
   133 begin
   131     FillChar(LuaDebugInfo, sizeof(LuaDebugInfo), 0);
   134     FillChar(LuaDebugInfo, sizeof(LuaDebugInfo), 0);