lua-users home
lua-l archive

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


Hi all,

I'm in the process of updating my no-frills guide to the Lua VM instructions for Lua 5.1, and it looks like the description for OP_TFORLOOP in lopcodes.h is incorrect. The description as it appears in the Lua 5.1 sources is:

R(A+3), ... ,R(A+3+C) := R(A)(R(A+1), R(A+2));
if R(A+3) ~= nil then { pc++; R(A+2)=R(A+3); }

Should it be like this?

R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
if R(A+3) ~= nil then { R(A+2)=R(A+3); } else { pc++; }

(1) C is the number of results from the call
(2) pc++ is performed when the generic loop exits

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia