Backed out changeset 076b7d23fab8. Well, the commit in question was needed after all ... 0.9.24
authorWuzzy <Wuzzy2@mail.ru>
Wed, 22 Aug 2018 16:47:09 +0200
branch0.9.24
changeset 13695 09757d5aead3
parent 13693 076b7d23fab8
child 13784 c384117f90eb
Backed out changeset 076b7d23fab8. Well, the commit in question was needed after all ...
hedgewars/uScript.pas
--- a/hedgewars/uScript.pas	Wed Aug 22 00:40:11 2018 +0200
+++ b/hedgewars/uScript.pas	Wed Aug 22 16:47:09 2018 +0200
@@ -862,10 +862,10 @@
                 end;
             end
             else
-                lua_pushnil(L);
+                lua_pushnumber(L,0);
         end
     else
-        lua_pushnil(L); // return value on stack (nil)
+        lua_pushnumber(L,0); // return value on stack (nil)
     lc_addvisualgear:= 1; // 1 return value
 end;
 
@@ -904,7 +904,7 @@
 function lc_getvisualgearvalues(L : Plua_State) : LongInt; Cdecl;
 var vg: PVisualGear;
 begin
-    if not(cOnlyStats) and CheckLuaParamCount(L, 1, 'GetVisualGearValues', 'vgUid') then
+    if not(cOnlyStats) and (Trunc(lua_tonumber(L, 1)) > 0) and CheckLuaParamCount(L, 1, 'GetVisualGearValues', 'vgUid') then
         begin
         vg:= VisualGearByUID(Trunc(lua_tonumber(L, 1)));
         if vg <> nil then
@@ -922,14 +922,14 @@
             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);
+            lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0);
+            lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0);
             end
         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);
+        lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0);
+        lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0); lua_pushnumber(L, 0);
         end;
     lc_getvisualgearvalues:= 10
 end;
@@ -938,7 +938,7 @@
 var vg : PVisualGear;
 begin
     lc_setvisualgearvalues:= 0;
-	if cOnlyStats then exit;
+    if cOnlyStats or (Trunc(lua_tonumber(L, 1)) = 0) then exit;
 // Param count can be 1-11 at present
 //    if CheckLuaParamCount(L, 11, 'SetVisualGearValues', 'vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint') then
 //        begin