diff options
-rw-r--r-- | plugins/lua/lua.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index 6f3fc27f..06e0f6eb 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -1482,17 +1482,22 @@ static void inject_string(script_info *info, char const *line) lua_State *L = info->state; int base, top; char *ret_line; + gboolean force_ret = FALSE; if(line[0] == '=') + { line++; + force_ret = TRUE; + } ret_line = g_strconcat("return ", line, NULL); lua_rawgeti(L, LUA_REGISTRYINDEX, info->traceback); base = lua_gettop(L); if(luaL_loadbuffer(L, ret_line, strlen(ret_line), "@interpreter")) { - lua_pop(L, 1); - if(luaL_loadbuffer(L, line, strlen(line), "@interpreter")) + if(!force_ret) + lua_pop(L, 1); + if(force_ret || luaL_loadbuffer(L, line, strlen(line), "@interpreter")) { hexchat_printf(ph, "Lua syntax error: %s", luaL_optstring(L, -1, "")); lua_pop(L, 2); |