function myLoginEvent(index)
-- 读取
local x = Char.GetData(index,%对象_x%);
local y = Char.GetData(index,%对象_y%);
-- 读取再写入
local xue = Char.GetData(index,%对象_血%);
Char.SetData(index,xue + 100);
-- field库读写
Field.Set(index,"xpos",x);
end
引用newobject.lua.share库之后 您可以以下简洁的代码
等价于上述代码
      
function myLoginEvent(index)
local player = new.object(index);
local x = player[%对象_x%];
local y = player[%对象_y%];
player[%对象_血%] = player[%对象_血%] + 100;
local pf = new.field(index);
pf["xpos"] = player[%对象_x%];
end