diff -r d0920e92008e -r 3aa85b5f3318 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Sat Aug 21 22:36:59 2010 +0200 +++ b/hedgewars/uScript.pas Sat Aug 21 22:54:43 2010 +0200 @@ -118,40 +118,46 @@ end; function lc_spawnhealthcrate(L: Plua_State) : LongInt; Cdecl; +var gear: PGear; begin if lua_gettop(L) <> 2 then begin LuaError('Lua: Wrong number of parameters passed to SpawnHealthCrate!'); lua_pushnil(L); end else begin - SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), + gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), HealthCrate, 0); + lua_pushnumber(L, gear^.uid); end; lc_spawnhealthcrate := 1; end; function lc_spawnammocrate(L: PLua_State): LongInt; Cdecl; +var gear: PGear; begin if lua_gettop(L) <> 3 then begin LuaError('Lua: Wrong number of parameters passed to SpawnAmmoCrate!'); lua_pushnil(L); end else begin - SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), + gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3)); + lua_pushnumber(L, gear^.uid); end; lc_spawnammocrate := 1; end; function lc_spawnutilitycrate(L: PLua_State): LongInt; Cdecl; +var gear: PGear; begin if lua_gettop(L) <> 3 then begin LuaError('Lua: Wrong number of parameters passed to SpawnUtilityCrate!'); lua_pushnil(L); end else begin - SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), + gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), UtilityCrate, lua_tointeger(L, 3)); + lua_pushnumber(L, gear^.uid); end; lc_spawnutilitycrate := 1; end;