hedgewars/uScript.pas
changeset 4682 0fc1ff341482
parent 4629 b5d726bc4f8d
child 4767 4ee4a49549e2
equal deleted inserted replaced
4680:831356774a88 4682:0fc1ff341482
   439             lua_pushinteger(L, gear^.message)
   439             lua_pushinteger(L, gear^.message)
   440         else
   440         else
   441             lua_pushnil(L);
   441             lua_pushnil(L);
   442         end;
   442         end;
   443     lc_getgearmessage:= 1
   443     lc_getgearmessage:= 1
       
   444 end;
       
   445 
       
   446 function lc_getgearelasticity(L : Plua_State) : LongInt; Cdecl;
       
   447 var gear : PGear;
       
   448 begin
       
   449     if lua_gettop(L) <> 1 then
       
   450         begin
       
   451         LuaError('Lua: Wrong number of parameters passed to GetGearElasticity!');
       
   452         lua_pushnil(L); // return value on stack (nil)
       
   453         end
       
   454     else
       
   455         begin
       
   456         gear:= GearByUID(lua_tointeger(L, 1));
       
   457         if gear <> nil then
       
   458             lua_pushinteger(L, hwRound(gear^.elasticity * _10000))
       
   459         else
       
   460             lua_pushnil(L);
       
   461         end;
       
   462     lc_getgearelasticity:= 1
   444 end;
   463 end;
   445 
   464 
   446 function lc_setgearmessage(L : Plua_State) : LongInt; Cdecl;
   465 function lc_setgearmessage(L : Plua_State) : LongInt; Cdecl;
   447 var gear : PGear;
   466 var gear : PGear;
   448 begin
   467 begin
  1502 lua_register(luaState, 'GetZoom', @lc_getzoom);
  1521 lua_register(luaState, 'GetZoom', @lc_getzoom);
  1503 lua_register(luaState, 'HogSay', @lc_hogsay);
  1522 lua_register(luaState, 'HogSay', @lc_hogsay);
  1504 lua_register(luaState, 'HogTurnLeft', @lc_hogturnleft);
  1523 lua_register(luaState, 'HogTurnLeft', @lc_hogturnleft);
  1505 lua_register(luaState, 'CampaignLock', @lc_campaignlock);
  1524 lua_register(luaState, 'CampaignLock', @lc_campaignlock);
  1506 lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock);
  1525 lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock);
       
  1526 lua_register(luaState, 'GetGearElasticity', @lc_getgearelasticity);
  1507 lua_register(luaState, 'GetGearMessage', @lc_getgearmessage);
  1527 lua_register(luaState, 'GetGearMessage', @lc_getgearmessage);
  1508 lua_register(luaState, 'SetGearMessage', @lc_setgearmessage);
  1528 lua_register(luaState, 'SetGearMessage', @lc_setgearmessage);
  1509 lua_register(luaState, 'GetRandom', @lc_getrandom);
  1529 lua_register(luaState, 'GetRandom', @lc_getrandom);
  1510 lua_register(luaState, 'SetWind', @lc_setwind);
  1530 lua_register(luaState, 'SetWind', @lc_setwind);
  1511 lua_register(luaState, 'GetDataPath', @lc_getdatapath);
  1531 lua_register(luaState, 'GetDataPath', @lc_getdatapath);