hedgewars/uScript.pas
changeset 5013 04789ba3f200
parent 4985 304d149bb3dd
child 5016 9347d82a26cc
--- a/hedgewars/uScript.pas	Mon Mar 14 20:08:53 2011 +0300
+++ b/hedgewars/uScript.pas	Wed Mar 16 17:25:05 2011 +0100
@@ -1285,6 +1285,16 @@
             sprAmGirder, lua_tointeger(L, 3), true, false);
     lc_placegirder:= 0
 end;
+
+function lc_getcurammotype(L : Plua_State): LongInt; Cdecl;
+var gear : PGear;
+begin
+    if lua_gettop(L) <> 0 then
+        LuaError('Lua: Wrong number of parameters passed to GetCurAmmoType!')
+    else
+        lua_pushinteger(L, ord(CurrentHedgehog^.CurAmmoType));
+    lc_getcurammotype := 1;
+end;
 ///////////////////
 
 procedure ScriptPrintStack;
@@ -1705,6 +1715,7 @@
 lua_register(luaState, 'GetHogHat', @lc_gethoghat);
 lua_register(luaState, 'SetHogHat', @lc_sethoghat);
 lua_register(luaState, 'PlaceGirder', @lc_placegirder);
+lua_register(luaState, 'GetCurAmmoType', @lc_getcurammotype);
 
 
 ScriptClearStack; // just to be sure stack is empty