hedgewars/uScript.pas
changeset 4780 8571151411b3
parent 4767 4ee4a49549e2
child 4832 e55e2b6f59b0
--- a/hedgewars/uScript.pas	Wed Dec 29 17:27:33 2010 +0100
+++ b/hedgewars/uScript.pas	Wed Dec 29 16:21:30 2010 -0500
@@ -272,6 +272,7 @@
         t:= lua_tointeger(L, 7);
 
         gear:= AddGear(x, y, gt, s, dx, dy, t);
+        lastGearByUID:= gear;
         lua_pushinteger(L, gear^.uid)
         end;
     lc_addgear:= 1; // 1 return value
@@ -311,8 +312,12 @@
         s:= lua_tointeger(L, 4);
         c:= lua_toboolean(L, 5);
 
-        vg:= AddVisualGear(x, y, vgt, s, c); 
-        if vg <> nil then lua_pushinteger(L, vg^.uid)
+        vg:= AddVisualGear(x, y, vgt, s, c);
+        if vg <> nil then 
+            begin
+            lastVisualGearByUID:= vg;
+            lua_pushinteger(L, vg^.uid)
+            end
         else lua_pushinteger(L, 0)
         end;
     lc_addvisualgear:= 1; // 1 return value