diff options
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.137 2017/11/28 12:58:18 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.138 2017/11/28 15:26:15 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -152,7 +152,17 @@ int luaK_jump (FuncState *fs) { | |||
152 | ** Code a 'return' instruction | 152 | ** Code a 'return' instruction |
153 | */ | 153 | */ |
154 | void luaK_ret (FuncState *fs, int first, int nret) { | 154 | void luaK_ret (FuncState *fs, int first, int nret) { |
155 | luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); | 155 | switch (nret) { |
156 | case 0: | ||
157 | luaK_codeABC(fs, OP_RETURN0, 0, 0, 0); | ||
158 | break; | ||
159 | case 1: | ||
160 | luaK_codeABC(fs, OP_RETURN1, first, 0, 0); | ||
161 | break; | ||
162 | default: | ||
163 | luaK_codeABC(fs, OP_RETURN, first, nret + 1, 0); | ||
164 | break; | ||
165 | } | ||
156 | } | 166 | } |
157 | 167 | ||
158 | 168 | ||