diff -r 25d36d8935cc -r 6bf91006d630 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Fri Sep 09 15:57:30 2016 +0000 +++ b/hedgewars/uScript.pas Thu Sep 15 23:16:49 2016 +0200 @@ -2540,6 +2540,22 @@ lc_declareachievement:= 0 end; +function lc_getammoname(L : Plua_state) : LongInt; Cdecl; +var at: LongInt; +const call = 'GetAmmoName'; + params = 'ammoType'; +begin + if CheckLuaParamCount(L, 1, call, params) then + begin + at:= LuaToAmmoTypeOrd(L, 1, call, params); + if at >= 0 then + lua_pushstring(L, Str2PChar(trammo[Ammoz[TAmmoType(at)].NameId])); + end + else + lua_pushnil(L); + lc_getammoname:= 1; +end; + function lc_startghostpoints(L : Plua_State) : LongInt; Cdecl; begin if CheckLuaParamCount(L, 1, 'StartGhostPoints', 'count') then @@ -3363,6 +3379,7 @@ lua_register(luaState, _P'SetWeapon', @lc_setweapon); lua_register(luaState, _P'SetCinematicMode', @lc_setcinematicmode); lua_register(luaState, _P'SetMaxBuildDistance', @lc_setmaxbuilddistance); +lua_register(luaState, _P'GetAmmoName', @lc_getammoname); // drawn map functions lua_register(luaState, _P'AddPoint', @lc_addPoint); lua_register(luaState, _P'FlushPoints', @lc_flushPoints);