hedgewars/uScript.pas
changeset 4450 b8d30b0e4829
parent 4443 d393b9ccd328
child 4453 15a483b2558a
equal deleted inserted replaced
4449:796bbec1101c 4450:b8d30b0e4829
   313 end;
   313 end;
   314 
   314 
   315 function lc_setvisualgearvalues(L : Plua_State) : LongInt; Cdecl;
   315 function lc_setvisualgearvalues(L : Plua_State) : LongInt; Cdecl;
   316 var vg : PVisualGear;
   316 var vg : PVisualGear;
   317 begin
   317 begin
   318     if lua_gettop(L) <> 10 then
   318     if lua_gettop(L) <> 11 then
   319         begin
   319         begin
   320         LuaError('Lua: Wrong number of parameters passed to SetVisualGearValues!');
   320         LuaError('Lua: Wrong number of parameters passed to SetVisualGearValues!');
   321         lua_pushnil(L); // return value on stack (nil)
   321         lua_pushnil(L); // return value on stack (nil)
   322         end
   322         end
   323     else
   323     else
   324         begin
   324         begin
   325         vg:= VisualGearByUID(lua_tointeger(L, 1));
   325         vg:= VisualGearByUID(lua_tointeger(L, 1));
   326         if vg <> nil then
   326         if vg <> nil then
   327             begin
   327             begin
   328             vg^.X:= lua_tointeger(L, 1);
   328             vg^.X:= lua_tointeger(L, 2);
   329             vg^.Y:= lua_tointeger(L, 2);
   329             vg^.Y:= lua_tointeger(L, 3);
   330             vg^.dX:= lua_tonumber(L, 3);
   330             vg^.dX:= lua_tonumber(L, 4);
   331             vg^.dY:= lua_tonumber(L, 4);
   331             vg^.dY:= lua_tonumber(L, 5);
   332             vg^.Angle:= lua_tonumber(L, 5);
   332             vg^.Angle:= lua_tonumber(L, 6);
   333             vg^.Frame:= lua_tointeger(L, 6);
   333             vg^.Frame:= lua_tointeger(L, 7);
   334             vg^.FrameTicks:= lua_tointeger(L, 7);
   334             vg^.FrameTicks:= lua_tointeger(L, 8);
   335             vg^.State:= lua_tointeger(L, 8);
   335             vg^.State:= lua_tointeger(L, 9);
   336             vg^.Timer:= lua_tointeger(L, 9);
   336             vg^.Timer:= lua_tointeger(L, 10);
   337             vg^.Tint:= lua_tointeger(L, 10);
   337             vg^.Tint:= lua_tointeger(L, 11);
   338             end
   338             end
   339         end;
   339         end;
   340     lc_setvisualgearvalues:= 0;
   340     lc_setvisualgearvalues:= 0;
   341 end;
   341 end;
   342 
   342