** Read a line and try to load (compile) it first as an expression (by ** adding "return " in front of it) and second as a statement. Return ** the final status of load/call with the resulting function (if any) ** in the top of the stack. */
| 162 | ** in the top of the stack. |
| 163 | */ |
| 164 | static int loadline(lua_State *L) |
| 165 | { |
| 166 | int status; |
| 167 | if ((status = addreturn(L)) != LUA_OK) { /* 'return ...' did not work? */ |
| 168 | // status = multiline(L); /* try as command, maybe with continuation lines */ |
| 169 | size_t len; |
| 170 | const char *line = lua_tolstring(L, 1, &len); /* get what it has */ |
| 171 | status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */ |
| 172 | } |
| 173 | lua_remove(L, 1); /* remove line from the stack */ |
| 174 | lua_assert(lua_gettop(L) == 1); |
| 175 | return status; |
| 176 | } |
| 177 | |
| 178 | /* |
| 179 | ** Check whether 'status' is not OK and, if so, prints the error |
no test coverage detected