Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/editors/fxite/files/patch-src_fxasq__lua.c
16461 views
1
--- src/fxasq_lua.c.orig 2013-10-03 09:22:51 UTC
2
+++ src/fxasq_lua.c
3
@@ -31,6 +31,9 @@
4
#include "intl.h"
5
#include "fxasq_lua.h"
6
7
+#if LUA_VERSION_NUM<502
8
+# define lua_rawlen lua_objlen
9
+#endif
10
11
#define DLG_MODULE_NAME "dialog"
12
#define MetaName "_fxasq_metatable"
13
@@ -234,7 +237,7 @@ static int asq_new(lua_State *L) {
14
if (argc>=2) {
15
luaL_argcheck(L,lua_istable(L,2),2,_("expected table"));
16
}
17
- n=lua_objlen(L,2);
18
+ n=lua_rawlen(L,2);
19
for (i=1;i<=n; i++) {
20
lua_rawgeti(L,2,i);
21
char msg[64];
22
@@ -301,7 +304,7 @@ static int asq_done(lua_State *L)
23
24
25
26
-static const struct luaL_reg asq_funcs[] = {
27
+static const struct luaL_Reg asq_funcs[] = {
28
{"new", asq_new},
29
{"run", asq_run},
30
{"label", asq_label},
31
@@ -330,12 +333,15 @@ int luaopen_dialog(lua_State *L)
32
lua_pushvalue(L, -2);
33
lua_settable(L, -3);
34
35
- luaL_getmetatable(L, MetaName);
36
lua_pushstring(L,"__gc");
37
lua_pushcfunction(L,asq_done);
38
lua_rawset(L,-3);
39
40
- luaL_register(L, NULL, &asq_funcs[1]);
41
- luaL_register(L, DLG_MODULE_NAME, asq_funcs);
42
- return 0;
43
+#if LUA_VERSION_NUM < 502
44
+ luaL_Register(L, NULL, &asq_funcs[1]);
45
+ luaL_Register(L, DLG_MODULE_NAME, asq_funcs);
46
+#else
47
+ luaL_setfuncs(L,asq_funcs,0);
48
+#endif
49
+ return 1;
50
}
51
52