diff options
author | mniip <mniip@mniip.com> | 2016-07-14 17:04:58 +0300 |
---|---|---|
committer | mniip <mniip@mniip.com> | 2016-07-14 17:04:58 +0300 |
commit | 9ca1606e2aeece48e6757312575f5f130cf56067 (patch) | |
tree | 0d6da01412d59c3a48db58f998d37ce6a488035c /plugins | |
parent | 9c049271e79764c7ca32a55072c7de11237ae26b (diff) |
lua: Force 'return' when = is present
Diffstat (limited to 'plugins')
-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); |