Path: blob/main/editors/fxite/files/patch-src_fxasq__lua.c
16461 views
--- src/fxasq_lua.c.orig 2013-10-03 09:22:51 UTC1+++ src/fxasq_lua.c2@@ -31,6 +31,9 @@3#include "intl.h"4#include "fxasq_lua.h"56+#if LUA_VERSION_NUM<5027+# define lua_rawlen lua_objlen8+#endif910#define DLG_MODULE_NAME "dialog"11#define MetaName "_fxasq_metatable"12@@ -234,7 +237,7 @@ static int asq_new(lua_State *L) {13if (argc>=2) {14luaL_argcheck(L,lua_istable(L,2),2,_("expected table"));15}16- n=lua_objlen(L,2);17+ n=lua_rawlen(L,2);18for (i=1;i<=n; i++) {19lua_rawgeti(L,2,i);20char msg[64];21@@ -301,7 +304,7 @@ static int asq_done(lua_State *L)22232425-static const struct luaL_reg asq_funcs[] = {26+static const struct luaL_Reg asq_funcs[] = {27{"new", asq_new},28{"run", asq_run},29{"label", asq_label},30@@ -330,12 +333,15 @@ int luaopen_dialog(lua_State *L)31lua_pushvalue(L, -2);32lua_settable(L, -3);3334- luaL_getmetatable(L, MetaName);35lua_pushstring(L,"__gc");36lua_pushcfunction(L,asq_done);37lua_rawset(L,-3);3839- luaL_register(L, NULL, &asq_funcs[1]);40- luaL_register(L, DLG_MODULE_NAME, asq_funcs);41- return 0;42+#if LUA_VERSION_NUM < 50243+ luaL_Register(L, NULL, &asq_funcs[1]);44+ luaL_Register(L, DLG_MODULE_NAME, asq_funcs);45+#else46+ luaL_setfuncs(L,asq_funcs,0);47+#endif48+ return 1;49}505152