** Try to compile line on the stack as 'return ;'; on return, stack ** has either compiled chunk or original line (if compilation failed). */
| 586 | ** has either compiled chunk or original line (if compilation failed). |
| 587 | */ |
| 588 | static int addreturn (lua_State *L) { |
| 589 | const char *line = lua_tostring(L, -1); /* original line */ |
| 590 | const char *retline = lua_pushfstring(L, "return %s;", line); |
| 591 | int status = luaL_loadbuffer(L, retline, strlen(retline), "=stdin"); |
| 592 | if (status == LUA_OK) |
| 593 | lua_remove(L, -2); /* remove modified line */ |
| 594 | else |
| 595 | lua_pop(L, 2); /* pop result from 'luaL_loadbuffer' and modified line */ |
| 596 | return status; |
| 597 | } |
| 598 | |
| 599 | |
| 600 | static void checklocal (const char *line) { |
no test coverage detected