hedgewars/uScript.pas
changeset 5899 0c3db82e9f4d
parent 5897 0e0fc7e08a3d
parent 5896 9ce1cf4e5a32
child 5900 37516a3bdb0e
equal deleted inserted replaced
5897:0e0fc7e08a3d 5899:0c3db82e9f4d
  1500     if lua_gettop(L) <> 0 then
  1500     if lua_gettop(L) <> 0 then
  1501         LuaError('Lua: Wrong number of parameters passed to GetCurAmmoType!')
  1501         LuaError('Lua: Wrong number of parameters passed to GetCurAmmoType!')
  1502     else
  1502     else
  1503         lua_pushinteger(L, ord(CurrentHedgehog^.CurAmmoType));
  1503         lua_pushinteger(L, ord(CurrentHedgehog^.CurAmmoType));
  1504     lc_getcurammotype := 1;
  1504     lc_getcurammotype := 1;
       
  1505 end;
       
  1506 
       
  1507 // boolean TestRectForObstacle(x1, y1, x2, y2, landOnly)
       
  1508 function lc_testrectforobstacle(L : Plua_State) : LongInt; Cdecl;
       
  1509 var rtn: Boolean;
       
  1510 begin
       
  1511     if lua_gettop(L) <> 5 then
       
  1512         begin
       
  1513         LuaError('Lua: Wrong number of parameters passed to TestRectForObstacle!');
       
  1514         lua_pushnil(L); // return value on stack (nil)
       
  1515         end
       
  1516     else
       
  1517         begin
       
  1518         rtn:= TestRectancleForObstacle(
       
  1519                     lua_tointeger(L, 1),
       
  1520                     lua_tointeger(L, 2),
       
  1521                     lua_tointeger(L, 3),
       
  1522                     lua_tointeger(L, 4),
       
  1523                     lua_toboolean(L, 5)
       
  1524                     );
       
  1525         lua_pushboolean(L, rtn);
       
  1526         end;
       
  1527     lc_testrectforobstacle:= 1
  1505 end;
  1528 end;
  1506 ///////////////////
  1529 ///////////////////
  1507 
  1530 
  1508 procedure ScriptPrintStack;
  1531 procedure ScriptPrintStack;
  1509 var n, i : LongInt;
  1532 var n, i : LongInt;
  1984 lua_register(luaState, 'MapHasBorder', @lc_maphasborder);
  2007 lua_register(luaState, 'MapHasBorder', @lc_maphasborder);
  1985 lua_register(luaState, 'GetHogHat', @lc_gethoghat);
  2008 lua_register(luaState, 'GetHogHat', @lc_gethoghat);
  1986 lua_register(luaState, 'SetHogHat', @lc_sethoghat);
  2009 lua_register(luaState, 'SetHogHat', @lc_sethoghat);
  1987 lua_register(luaState, 'PlaceGirder', @lc_placegirder);
  2010 lua_register(luaState, 'PlaceGirder', @lc_placegirder);
  1988 lua_register(luaState, 'GetCurAmmoType', @lc_getcurammotype);
  2011 lua_register(luaState, 'GetCurAmmoType', @lc_getcurammotype);
       
  2012 lua_register(luaState, 'TestRectForObstacle', @lc_testrectforobstacle);
  1989 
  2013 
  1990 
  2014 
  1991 ScriptClearStack; // just to be sure stack is empty
  2015 ScriptClearStack; // just to be sure stack is empty
  1992 ScriptLoaded:= false;
  2016 ScriptLoaded:= false;
  1993 end;
  2017 end;