lua-users home
lua-l archive

avoid table lookups?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,
Is it worth in Lua, at start of a func or before a loop, to "localise" table fields? As in:
f = function (t)
 local x = t.x
 if x < 0 then
 ... use x ...
 else
 ... use x ...
 end
 ...
 local z = t.y.z
 for i = 1, 1000 do
 ... use z ...
 end
 ...
end
Thank you,
Denis

AltStyle によって変換されたページ (->オリジナル) /