hedgewars/uScript.pas
changeset 7307 f830a65d6a6d
parent 7270 93e92e82d5c8
child 7337 c224cd2d32f3
equal deleted inserted replaced
7305:b242e91a92a9 7307:f830a65d6a6d
   182         LuaError('Lua: Wrong number of parameters passed to WriteLnToConsole!');
   182         LuaError('Lua: Wrong number of parameters passed to WriteLnToConsole!');
   183     lc_writelntoconsole:= 0;
   183     lc_writelntoconsole:= 0;
   184 end;
   184 end;
   185 
   185 
   186 function lc_parsecommand(L : Plua_State) : LongInt; Cdecl;
   186 function lc_parsecommand(L : Plua_State) : LongInt; Cdecl;
       
   187 var t: PChar;
       
   188     i,c: LongWord;
       
   189     s: shortstring;
   187 begin
   190 begin
   188     if lua_gettop(L) = 1 then
   191     if lua_gettop(L) = 1 then
   189         begin
   192         begin
   190         ParseCommand(lua_tostring(L ,1), true);
   193         t:= lua_tolstring(L,1,@c);
       
   194 
       
   195         for i:= 1 to c do s[i]:= t[i-1];
       
   196         s[0]:= char(c);
       
   197 
       
   198         ParseCommand(s, true);
       
   199 
   191         end
   200         end
   192     else
   201     else
   193         LuaError('Lua: Wrong number of parameters passed to ParseCommand!');
   202         LuaError('Lua: Wrong number of parameters passed to ParseCommand!');
   194     lc_parsecommand:= 0;
   203     lc_parsecommand:= 0;
   195 end;
   204 end;