hedgewars/uScript.pas
branch0.9.24
changeset 13688 076b7d23fab8
parent 13683 6c0cf6b9eff8
child 13690 09757d5aead3
--- a/hedgewars/uScript.pas	Tue Aug 21 15:26:29 2018 -0400
+++ b/hedgewars/uScript.pas	Wed Aug 22 00:40:11 2018 +0200
@@ -862,10 +862,10 @@
                 end;
             end
             else
-                lua_pushnumber(L,0);
+                lua_pushnil(L);
         end
     else
-        lua_pushnumber(L,0); // return value on stack (nil)
+        lua_pushnil(L); // 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 (Trunc(lua_tonumber(L, 1)) > 0) and CheckLuaParamCount(L, 1, 'GetVisualGearValues', 'vgUid') then
+    if not(cOnlyStats) 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_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);
+            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
     else
         begin
-        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);
+        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;
     lc_getvisualgearvalues:= 10
 end;
@@ -938,7 +938,7 @@
 var vg : PVisualGear;
 begin
     lc_setvisualgearvalues:= 0;
-    if cOnlyStats or (Trunc(lua_tonumber(L, 1)) = 0) then exit;
+	if cOnlyStats 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