hedgewars/uScript.pas
changeset 3368 791fa4664209
parent 3346 967fd96f7373
child 3407 dcc129c4352e
equal deleted inserted replaced
3367:8eb7ea4a9705 3368:791fa4664209
   482         end;
   482         end;
   483     lc_setgearposition:= 0
   483     lc_setgearposition:= 0
   484 end;
   484 end;
   485 
   485 
   486 function lc_setammo(L : Plua_State) : LongInt; Cdecl;
   486 function lc_setammo(L : Plua_State) : LongInt; Cdecl;
   487 begin
   487 var np: LongInt;
   488     if lua_gettop(L) <> 5 then
   488 begin
       
   489     np:= lua_gettop(L);
       
   490     if (np < 4) or (np > 5) then
   489         WriteLnToConsole('LUA: Wrong number of parameters passed to SetAmmo!')
   491         WriteLnToConsole('LUA: Wrong number of parameters passed to SetAmmo!')
   490     else
   492     else if np = 4 then
   491         begin
   493         ScriptSetAmmo(TAmmoType(lua_tointeger(L, 1)), lua_tointeger(L, 2), lua_tointeger(L, 3), lua_tointeger(L, 4), 1)
       
   494     else
   492         ScriptSetAmmo(TAmmoType(lua_tointeger(L, 1)), lua_tointeger(L, 2), lua_tointeger(L, 3), lua_tointeger(L, 4), lua_tointeger(L, 5));
   495         ScriptSetAmmo(TAmmoType(lua_tointeger(L, 1)), lua_tointeger(L, 2), lua_tointeger(L, 3), lua_tointeger(L, 4), lua_tointeger(L, 5));
   493         end;
       
   494     lc_setammo:= 0
   496     lc_setammo:= 0
   495 end;
   497 end;
   496 ///////////////////
   498 ///////////////////
   497 
   499 
   498 procedure ScriptPrintStack;
   500 procedure ScriptPrintStack;