hedgewars/uScript.pas
changeset 5896 9ce1cf4e5a32
parent 5825 a6eab1b7c00d
child 5899 0c3db82e9f4d
equal deleted inserted replaced
5895:212d3b459658 5896:9ce1cf4e5a32
  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;
  1981 lua_register(luaState, 'MapHasBorder', @lc_maphasborder);
  2004 lua_register(luaState, 'MapHasBorder', @lc_maphasborder);
  1982 lua_register(luaState, 'GetHogHat', @lc_gethoghat);
  2005 lua_register(luaState, 'GetHogHat', @lc_gethoghat);
  1983 lua_register(luaState, 'SetHogHat', @lc_sethoghat);
  2006 lua_register(luaState, 'SetHogHat', @lc_sethoghat);
  1984 lua_register(luaState, 'PlaceGirder', @lc_placegirder);
  2007 lua_register(luaState, 'PlaceGirder', @lc_placegirder);
  1985 lua_register(luaState, 'GetCurAmmoType', @lc_getcurammotype);
  2008 lua_register(luaState, 'GetCurAmmoType', @lc_getcurammotype);
       
  2009 lua_register(luaState, 'TestRectForObstacle', @lc_testrectforobstacle);
  1986 
  2010 
  1987 
  2011 
  1988 ScriptClearStack; // just to be sure stack is empty
  2012 ScriptClearStack; // just to be sure stack is empty
  1989 ScriptLoaded:= false;
  2013 ScriptLoaded:= false;
  1990 end;
  2014 end;