lua-users home
lua-l archive

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

Roberto Ierusalimschy wrote:
The correctness of this code rests on the assumption that the GC will
not run between the two assignments. It seems better style the other way

 local temp = translators[key] or {}
 translators[key] = temp
 ... (use 'temp' for the rest of this code) ...

(Actually the assumption may be wrong! a line hook may cause a GC between
the two lines when debugging this code ;)

-- Roberto

Good catch! Also has the benefit of being slightly quicker. Will have to look out for that one.

- Alex