# HG changeset patch # User nemo # Date 1340766145 14400 # Node ID f830a65d6a6d61691eb8d5b8b67ce262212ebc4d # Parent b242e91a92a98ab910b6729f4352c53696399419 This is necessary because commands can contain 0s, and StrPas used by LuaPas halts at the first 0. It might be necessary to change the base string handling. diff -r b242e91a92a9 -r f830a65d6a6d hedgewars/uScript.pas --- a/hedgewars/uScript.pas Tue Jun 26 20:05:24 2012 -0400 +++ b/hedgewars/uScript.pas Tue Jun 26 23:02:25 2012 -0400 @@ -184,10 +184,19 @@ end; function lc_parsecommand(L : Plua_State) : LongInt; Cdecl; +var t: PChar; + i,c: LongWord; + s: shortstring; begin if lua_gettop(L) = 1 then begin - ParseCommand(lua_tostring(L ,1), true); + t:= lua_tolstring(L,1,@c); + + for i:= 1 to c do s[i]:= t[i-1]; + s[0]:= char(c); + + ParseCommand(s, true); + end else LuaError('Lua: Wrong number of parameters passed to ParseCommand!');