lua-users home
lua-l archive

Caching last used table index

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


I often write code like:
local foo = t.foo
if not foo then foo = whatever t.foo = foo end
-- use foo here
but ideally I'd like to write it like:
if not t.foo then t.foo = whatever end
local foo = t.foo
and still have the same performance (or better).
does lua do any optimizations related to this?

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