diff options
Diffstat (limited to 'lcode.c')
| -rw-r--r-- | lcode.c | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -706,6 +706,22 @@ static void luaK_float (FuncState *fs, int reg, lua_Number f) { | |||
| 706 | 706 | ||
| 707 | 707 | ||
| 708 | /* | 708 | /* |
| 709 | ** Get the value of 'var' in a register and generate an opcode to check | ||
| 710 | ** whether that register is nil. 'k' is the index of the variable name | ||
| 711 | ** in the list of constants. If its value cannot be encoded in Bx, a 0 | ||
| 712 | ** will use '?' for the name. | ||
| 713 | */ | ||
| 714 | void luaK_codecheckglobal (FuncState *fs, expdesc *var, int k, int line) { | ||
| 715 | luaK_exp2anyreg(fs, var); | ||
| 716 | luaK_fixline(fs, line); | ||
| 717 | k = (k >= MAXARG_Bx) ? 0 : k + 1; | ||
| 718 | luaK_codeABx(fs, OP_ERRNNIL, var->u.info, k); | ||
| 719 | luaK_fixline(fs, line); | ||
| 720 | freeexp(fs, var); | ||
| 721 | } | ||
| 722 | |||
| 723 | |||
| 724 | /* | ||
| 709 | ** Convert a constant in 'v' into an expression description 'e' | 725 | ** Convert a constant in 'v' into an expression description 'e' |
| 710 | */ | 726 | */ |
| 711 | static void const2exp (TValue *v, expdesc *e) { | 727 | static void const2exp (TValue *v, expdesc *e) { |
