hedgewars/uScript.pas
changeset 7307 f830a65d6a6d
parent 7270 93e92e82d5c8
child 7337 c224cd2d32f3
--- 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!');