@@ -224,8 +224,8 @@ enum OpMode {iABC, ivABC, iABx, iAsBx, iAx, isJ};
224224
225225
226226/*
227- ** Grep "ORDER OP" if you change these enums. Opcodes marked with a (*)
228- ** has extra descriptions in the notes after the enumeration .
227+ ** Grep "ORDER OP" if you change this enum.
228+ ** See "Notes" below for more information about some instructions .
229229*/
230230
231231typedef enum {
@@ -238,7 +238,7 @@ OP_LOADF,/* A sBx R[A] := (lua_Number)sBx */
238238OP_LOADK ,/* A Bx R[A] := K[Bx] */
239239OP_LOADKX ,/* A R[A] := K[extra arg] */
240240OP_LOADFALSE ,/* A R[A] := false */
241- OP_LFALSESKIP ,/*A R[A] := false; pc++ (*) */
241+ OP_LFALSESKIP ,/*A R[A] := false; pc++ */
242242OP_LOADTRUE ,/* A R[A] := true */
243243OP_LOADNIL ,/* A B R[A], R[A+1], ..., R[A+B] := nil */
244244OP_GETUPVAL ,/* A B R[A] := UpValue[B] */
@@ -289,7 +289,7 @@ OP_BXOR,/* A B C R[A] := R[B] ~ R[C] */
289289OP_SHL ,/* A B C R[A] := R[B] << R[C] */
290290OP_SHR ,/* A B C R[A] := R[B] >> R[C] */
291291
292- OP_MMBIN ,/* A B C call C metamethod over R[A] and R[B] (*) */
292+ OP_MMBIN ,/* A B C call C metamethod over R[A] and R[B] */
293293OP_MMBINI ,/* A sB C k call C metamethod over R[A] and sB */
294294OP_MMBINK ,/* A B C k call C metamethod over R[A] and K[B] */
295295
@@ -315,12 +315,12 @@ OP_GTI,/* A sB k if ((R[A] > sB) ~= k) then pc++ */
315315OP_GEI ,/* A sB k if ((R[A] >= sB) ~= k) then pc++ */
316316
317317OP_TEST ,/* A k if (not R[A] == k) then pc++ */
318- OP_TESTSET ,/* A B k if (not R[B] == k) then pc++ else R[A] := R[B] (*) */
318+ OP_TESTSET ,/* A B k if (not R[B] == k) then pc++ else R[A] := R[B] */
319319
320320OP_CALL ,/* A B C R[A], ... ,R[A+C-2] := R[A](R[A+1], ... ,R[A+B-1]) */
321321OP_TAILCALL ,/* A B C k return R[A](R[A+1], ... ,R[A+B-1]) */
322322
323- OP_RETURN ,/* A B C k return R[A], ... ,R[A+B-2] (see note) */
323+ OP_RETURN ,/* A B C k return R[A], ... ,R[A+B-2] */
324324OP_RETURN0 ,/* return */
325325OP_RETURN1 ,/* A return R[A] */
326326
@@ -336,13 +336,13 @@ OP_SETLIST,/* A vB vC k R[A][vC+i] := R[A+i], 1 <= i <= vB */
336336
337337OP_CLOSURE ,/* A Bx R[A] := closure(KPROTO[Bx]) */
338338
339- OP_VARARG ,/* A C R[A], R[A+1], ..., R[A+C-2] = vararg */
339+ OP_VARARG ,/* A B C k R[A], ..., R[A+C-2] = varargs */
340340
341341OP_GETVARG , /* A B C R[A] := R[B][R[C]], R[B] is vararg parameter */
342342
343- OP_ERRNNIL ,/* A Bx raise error if R[A] ~= nil (K[Bx] is global name)*/
343+ OP_ERRNNIL ,/* A Bx raise error if R[A] ~= nil (K[Bx - 1 ] is global name)*/
344344
345- OP_VARARGPREP ,/* (adjust vararg parameters) */
345+ OP_VARARGPREP ,/* (adjust varargs) */
346346
347347OP_EXTRAARG /* Ax extra (larger) argument for previous opcode */
348348} OpCode ;
@@ -371,7 +371,8 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
371371 OP_RETURN*, OP_SETLIST) may use 'top'.
372372
373373 (*) In OP_VARARG, if (C == 0) then use actual number of varargs and
374- set top (like in OP_CALL with C == 0).
374+ set top (like in OP_CALL with C == 0). 'k' means function has a
375+ vararg table, which is in R[B].
375376
376377 (*) In OP_RETURN, if (B == 0) then return up to 'top'.
377378
@@ -386,18 +387,23 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
386387 power of 2) plus 1, or zero for size zero. If not k, the array size
387388 is vC. Otherwise, the array size is EXTRAARG _ vC.
388389
390+ (*) In OP_ERRNNIL, (Bx == 0) means index of global name doesn't
391+ fit in Bx. (So, that name is not available for the error message.)
392+
389393 (*) For comparisons, k specifies what condition the test should accept
390394 (true or false).
391395
392396 (*) In OP_MMBINI/OP_MMBINK, k means the arguments were flipped
393- (the constant is the first operand).
397+ (the constant is the first operand).
394398
395- (*) All 'skips' (pc++) assume that next instruction is a jump.
399+ (*) All comparison and test instructions assume that the instruction
400+ being skipped (pc++) is a jump.
396401
397402 (*) In instructions OP_RETURN/OP_TAILCALL, 'k' specifies that the
398403 function builds upvalues, which may need to be closed. C > 0 means
399- the function is vararg, so that its 'func' must be corrected before
400- returning; in this case, (C - 1) is its number of fixed parameters.
404+ the function has hidden vararg arguments, so that its 'func' must be
405+ corrected before returning; in this case, (C - 1) is its number of
406+ fixed parameters.
401407
402408 (*) In comparisons with an immediate operand, C signals whether the
403409 original operand was a float. (It must be corrected in case of
0 commit comments