hedgewars/uScript.pas
changeset 9648 3a3defce1b28
parent 9567 42bc1b58a242
parent 9646 7588daa8d28f
child 9656 18422d205080
equal deleted inserted replaced
9583:37a6d807c140 9648:3a3defce1b28
  1290 function lc_sendstat(L : Plua_State) : LongInt; Cdecl;
  1290 function lc_sendstat(L : Plua_State) : LongInt; Cdecl;
  1291 var statInfo : TStatInfoType;
  1291 var statInfo : TStatInfoType;
  1292 var i : LongInt;
  1292 var i : LongInt;
  1293 var color : shortstring;
  1293 var color : shortstring;
  1294 begin
  1294 begin
  1295 	statInfo := TStatInfoType(GetEnumValue(TypeInfo(TStatInfoType),lua_tostring(L, 1)));
  1295 	statInfo := TStatInfoType(lua_tointeger(L, 1));
  1296 	if (lua_gettop(L) <> 2) and ((statInfo <> siPlayerKills) 
  1296 	if (lua_gettop(L) <> 2) and ((statInfo <> siPlayerKills) 
  1297 			and (statInfo <> siClanHealth)) then
  1297 			and (statInfo <> siClanHealth)) then
  1298         begin
  1298         begin
  1299         LuaError('Lua: Wrong number of parameters passed to SendStat! Expected 2 parameters.');
  1299         LuaError('Lua: Wrong number of parameters passed to SendStat! Expected 2 parameters.');
  1300         end
  1300         end
  2314 
  2314 
  2315 procedure initModule;
  2315 procedure initModule;
  2316 var at : TGearType;
  2316 var at : TGearType;
  2317     vgt: TVisualGearType;
  2317     vgt: TVisualGearType;
  2318     am : TAmmoType;
  2318     am : TAmmoType;
       
  2319     si : TStatInfoType;
  2319     st : TSound;
  2320     st : TSound;
  2320     he : THogEffect;
  2321     he : THogEffect;
  2321     cg : TCapGroup;
  2322     cg : TCapGroup;
  2322 begin
  2323 begin
  2323 // initialize lua
  2324 // initialize lua
  2396     ScriptSetInteger(EnumToStr(st), ord(st));
  2397     ScriptSetInteger(EnumToStr(st), ord(st));
  2397 
  2398 
  2398 // register ammo types
  2399 // register ammo types
  2399 for am:= Low(TAmmoType) to High(TAmmoType) do
  2400 for am:= Low(TAmmoType) to High(TAmmoType) do
  2400     ScriptSetInteger(EnumToStr(am), ord(am));
  2401     ScriptSetInteger(EnumToStr(am), ord(am));
       
  2402 
       
  2403 for si:= Low(TStatInfoType) to High(TStatInfoType) do
       
  2404     ScriptSetInteger(EnumToStr(si), ord(si));
  2401 
  2405 
  2402 for he:= Low(THogEffect) to High(THogEffect) do
  2406 for he:= Low(THogEffect) to High(THogEffect) do
  2403     ScriptSetInteger(EnumToStr(he), ord(he));
  2407     ScriptSetInteger(EnumToStr(he), ord(he));
  2404 
  2408 
  2405 for cg:= Low(TCapGroup) to High(TCapGroup) do
  2409 for cg:= Low(TCapGroup) to High(TCapGroup) do