return nil values if an invalid visual gear is passed to the get, add a check in Control map lua
--- a/hedgewars/uScript.pas Tue Dec 28 19:20:30 2010 -0500
+++ b/hedgewars/uScript.pas Tue Dec 28 19:32:21 2010 -0500
@@ -358,6 +358,11 @@
lua_pushinteger(L, vg^.Timer);
lua_pushinteger(L, vg^.Tint);
end
+ else
+ begin
+ lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L);
+ lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L)
+ end
end;
lc_getvisualgearvalues:= 10;
end;
--- a/share/hedgewars/Data/Maps/Control/map.lua Tue Dec 28 19:20:30 2010 -0500
+++ b/share/hedgewars/Data/Maps/Control/map.lua Tue Dec 28 19:32:21 2010 -0500
@@ -200,7 +200,9 @@
if CurrentHedgehog ~= nil then
if cOwnerClan[i] == GetHogClan(CurrentHedgehog) then
g = AddVisualGear(vCircX[i], vCircY[i], vgtHealthTag, 100, False)
- SetVisualGearValues(g, vCircX[i], vCircY[i], 0, 0, 0, 0, 0, teamScore[cOwnerClan[i]], 1500, GetClanColor(cOwnerClan[i]))
+ if g ~= 0 then
+ SetVisualGearValues(g, vCircX[i], vCircY[i], 0, 0, 0, 0, 0, teamScore[cOwnerClan[i]], 1500, GetClanColor(cOwnerClan[i]))
+ end
end
end
end