hedgewars/uScript.pas
changeset 4780 8571151411b3
parent 4767 4ee4a49549e2
child 4832 e55e2b6f59b0
equal deleted inserted replaced
4778:1565a553d200 4780:8571151411b3
   270         dx:= int2hwFloat(round(lua_tonumber(L, 5) * 1000)) / 1000;
   270         dx:= int2hwFloat(round(lua_tonumber(L, 5) * 1000)) / 1000;
   271         dy:= int2hwFloat(round(lua_tonumber(L, 6) * 1000)) / 1000;
   271         dy:= int2hwFloat(round(lua_tonumber(L, 6) * 1000)) / 1000;
   272         t:= lua_tointeger(L, 7);
   272         t:= lua_tointeger(L, 7);
   273 
   273 
   274         gear:= AddGear(x, y, gt, s, dx, dy, t);
   274         gear:= AddGear(x, y, gt, s, dx, dy, t);
       
   275         lastGearByUID:= gear;
   275         lua_pushinteger(L, gear^.uid)
   276         lua_pushinteger(L, gear^.uid)
   276         end;
   277         end;
   277     lc_addgear:= 1; // 1 return value
   278     lc_addgear:= 1; // 1 return value
   278 end;
   279 end;
   279 
   280 
   309         y:= lua_tointeger(L, 2);
   310         y:= lua_tointeger(L, 2);
   310         vgt:= TVisualGearType(lua_tointeger(L, 3));
   311         vgt:= TVisualGearType(lua_tointeger(L, 3));
   311         s:= lua_tointeger(L, 4);
   312         s:= lua_tointeger(L, 4);
   312         c:= lua_toboolean(L, 5);
   313         c:= lua_toboolean(L, 5);
   313 
   314 
   314         vg:= AddVisualGear(x, y, vgt, s, c); 
   315         vg:= AddVisualGear(x, y, vgt, s, c);
   315         if vg <> nil then lua_pushinteger(L, vg^.uid)
   316         if vg <> nil then 
       
   317             begin
       
   318             lastVisualGearByUID:= vg;
       
   319             lua_pushinteger(L, vg^.uid)
       
   320             end
   316         else lua_pushinteger(L, 0)
   321         else lua_pushinteger(L, 0)
   317         end;
   322         end;
   318     lc_addvisualgear:= 1; // 1 return value
   323     lc_addvisualgear:= 1; // 1 return value
   319 end;
   324 end;
   320 
   325