The following changes since commit ec5ef674043742b79bc862cc4ff43f9ff0601431:
Remove PREFIX, use CMAKE_INSTALL_PREFIX (2012-06-11 14:47:13 +0200) are available in the git repository at: https://github.com/Asido/AwesomeWM.git master Arvydas Sidorenko (14): Renamed luaL_reg to luaL_Reg Unnecessary #define's to static inline functions luaL_typerror -> luaA_typerror Missing file from last commit Changed all luaL_typerror to luaA_typerror Wrapped lua_[gs]etfenv into luaA_[gs]etuservalue lua_objlen wrapped in luaA_rawlen Portable way to replace standards Lua funcs Wrapped luaL_register Replaced already in Lua 5.1 deprecated lua_open() luaA_registerlib libname NULL segfaults Awesome Changed lua stack indexing with negative values Fixed luaA_registerlib to replace deprecated luaL_register Merge remote-tracking branch 'upstream/master' CMakeLists.txt | 1 + common/luaclass.c | 19 +++++----- common/luaclass.h | 4 +- common/lualib.c | 62 +++++++++++++++++++++++++++++++++ common/lualib.h | 46 +++---------------------- common/luaobject.h | 9 +++-- common/version.c | 2 +- dbus.c | 4 +- keygrabber.c | 2 +- luaa.c | 59 ++++++++++++++----------------- luaa.h | 96 +++++++++++++++++++++++++++++++++++++++++----------- mouse.c | 4 +- mousegrabber.c | 2 +- objects/button.c | 4 +- objects/client.c | 4 +- objects/drawin.c | 4 +- objects/key.c | 6 ++-- objects/tag.c | 4 +- objects/timer.c | 4 +- objects/window.c | 4 +- root.c | 2 +- screen.c | 4 +- 22 files changed, 213 insertions(+), 133 deletions(-) create mode 100644 common/lualib.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 62cb14f..e9f8aa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,7 @@ set(AWE_SRCS ${SOURCE_DIR}/common/backtrace.c ${SOURCE_DIR}/common/buffer.c ${SOURCE_DIR}/common/luaclass.c + ${SOURCE_DIR}/common/lualib.c ${SOURCE_DIR}/common/luaobject.c ${SOURCE_DIR}/common/util.c ${SOURCE_DIR}/common/version.c diff --git a/common/luaclass.c b/common/luaclass.c index 1ffe398..6d7a006 100644 --- a/common/luaclass.c +++ b/common/luaclass.c @@ -21,6 +21,7 @@ #include "common/luaclass.h" #include "common/luaobject.h" +#include "luaa.h" struct lua_class_property { @@ -76,7 +77,7 @@ luaA_checkudata(lua_State *L, int ud, lua_class_t *class) { void *p = luaA_toudata(L, ud, class); if(!p) - luaL_typerror(L, ud, class->name); + luaA_typerror(L, ud, class->name); else if(class->checker && !class->checker(p)) luaL_error(L, "invalid object"); return p; @@ -124,15 +125,15 @@ luaA_typename(lua_State *L, int idx) void luaA_openlib(lua_State *L, const char *name, - const struct luaL_reg methods[], - const struct luaL_reg meta[]) + const struct luaL_Reg methods[], + const struct luaL_Reg meta[]) { luaL_newmetatable(L, name); /* 1 */ lua_pushvalue(L, -1); /* dup metatable 2 */ lua_setfield(L, -2, "__index"); /* metatable.__index = metatable 1 */ - luaL_register(L, NULL, meta); /* 1 */ - luaL_register(L, name, methods); /* 2 */ + luaA_registerlib(L, NULL, meta); /* 1 */ + luaA_registerlib(L, name, methods); /* 2 */ lua_pushvalue(L, -1); /* dup self as metatable 3 */ lua_setmetatable(L, -2); /* set self as metatable 2 */ lua_pop(L, 2); @@ -206,8 +207,8 @@ luaA_class_setup(lua_State *L, lua_class_t *class, lua_class_checker_t checker, lua_class_propfunc_t index_miss_property, lua_class_propfunc_t newindex_miss_property, - const struct luaL_reg methods[], - const struct luaL_reg meta[]) + const struct luaL_Reg methods[], + const struct luaL_Reg meta[]) { /* Create the object metatable */ lua_newtable(L); @@ -231,8 +232,8 @@ luaA_class_setup(lua_State *L, lua_class_t *class, lua_setfield(L, -2, "__index"); /* metatable.__index = metatable 1 */ - luaL_register(L, NULL, meta); /* 1 */ - luaL_register(L, name, methods); /* 2 */ + luaA_registerlib(L, NULL, meta); /* 1 */ + luaA_registerlib(L, name, methods); /* 2 */ lua_pushvalue(L, -1); /* dup self as metatable 3 */ lua_setmetatable(L, -2); /* set self as metatable 2 */ lua_pop(L, 2); diff --git a/common/luaclass.h b/common/luaclass.h index b3ad71c..2684a92 100644 --- a/common/luaclass.h +++ b/common/luaclass.h @@ -79,12 +79,12 @@ void luaA_class_connect_signal_from_stack(lua_State *, lua_class_t *, const char void luaA_class_disconnect_signal_from_stack(lua_State *, lua_class_t *, const char *, int); void luaA_class_emit_signal(lua_State *, lua_class_t *, const char *, int); -void luaA_openlib(lua_State *, const char *, const struct luaL_reg[], const struct luaL_reg[]); +void luaA_openlib(lua_State *, const char *, const struct luaL_Reg[], const struct luaL_Reg[]); void luaA_class_setup(lua_State *, lua_class_t *, const char *, lua_class_t *, lua_class_allocator_t, lua_class_collector_t, lua_class_checker_t, lua_class_propfunc_t, lua_class_propfunc_t, - const struct luaL_reg[], const struct luaL_reg[]); + const struct luaL_Reg[], const struct luaL_Reg[]); void luaA_class_add_property(lua_class_t *, const char *, lua_class_propfunc_t, lua_class_propfunc_t, lua_class_propfunc_t); diff --git a/common/lualib.c b/common/lualib.c new file mode 100644 index 0000000..a53aa5c --- /dev/null +++ b/common/lualib.c @@ -0,0 +1,62 @@ +/* + * lualib.h - useful functions and type for Lua + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include "luaa.h" + +void luaA_checkfunction(lua_State *L, int idx) +{ + if(!lua_isfunction(L, idx)) + luaA_typerror(L, idx, "function"); +} + +void luaA_checktable(lua_State *L, int idx) +{ + if(!lua_istable(L, idx)) + luaA_typerror(L, idx, "table"); +} + +void luaA_dumpstack(lua_State *L) +{ + fprintf(stderr, "-------- Lua stack dump ---------\n"); + for(int i = lua_gettop(L); i; i--) + { + int t = lua_type(L, i); + switch (t) + { + case LUA_TSTRING: + fprintf(stderr, "%d: string: `%s'\n", i, lua_tostring(L, i)); + break; + case LUA_TBOOLEAN: + fprintf(stderr, "%d: bool: %s\n", i, lua_toboolean(L, i) ? "true" : "false"); + break; + case LUA_TNUMBER: + fprintf(stderr, "%d: number: %g\n", i, lua_tonumber(L, i)); + break; + case LUA_TNIL: + fprintf(stderr, "%d: nil\n", i); + break; + default: + fprintf(stderr, "%d: %s\t#%d\t%p\n", i, lua_typename(L, t), + (int) luaA_rawlen(L, i), + lua_topointer(L, i)); + break; + } + } + fprintf(stderr, "------- Lua stack dump end ------\n"); +} diff --git a/common/lualib.h b/common/lualib.h index 7226bac..59d6a16 100644 --- a/common/lualib.h +++ b/common/lualib.h @@ -23,50 +23,20 @@ #define AWESOME_COMMON_LUALIB #include <lauxlib.h> + #include "common/util.h" +#include "common/luaclass.h" /** Lua function to call on dofuction() error */ lua_CFunction lualib_dofunction_on_error; -#define luaA_checkfunction(L, n) \ - do { \ - if(!lua_isfunction(L, n)) \ - luaL_typerror(L, n, "function"); \ - } while(0) +void luaA_checkfunction(lua_State *, int); +void luaA_checktable(lua_State *, int); /** Dump the Lua stack. Useful for debugging. * \param L The Lua VM state. */ -static inline void -luaA_dumpstack(lua_State *L) -{ - fprintf(stderr, "-------- Lua stack dump ---------\n"); - for(int i = lua_gettop(L); i; i--) - { - int t = lua_type(L, i); - switch (t) - { - case LUA_TSTRING: - fprintf(stderr, "%d: string: `%s'\n", i, lua_tostring(L, i)); - break; - case LUA_TBOOLEAN: - fprintf(stderr, "%d: bool: %s\n", i, lua_toboolean(L, i) ? "true" : "false"); - break; - case LUA_TNUMBER: - fprintf(stderr, "%d: number: %g\n", i, lua_tonumber(L, i)); - break; - case LUA_TNIL: - fprintf(stderr, "%d: nil\n", i); - break; - default: - fprintf(stderr, "%d: %s\t#%d\t%p\n", i, lua_typename(L, t), - (int) lua_objlen(L, i), - lua_topointer(L, i)); - break; - } - } - fprintf(stderr, "------- Lua stack dump end ------\n"); -} +void luaA_dumpstack(lua_State *); /** Convert s stack index to positive. * \param L The Lua VM state. @@ -115,12 +85,6 @@ luaA_dofunction(lua_State *L, int nargs, int nret) return true; } -#define luaA_checktable(L, n) \ - do { \ - if(!lua_istable(L, n)) \ - luaL_typerror(L, n, "table"); \ - } while(0) - #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/common/luaobject.h b/common/luaobject.h index 6580065..09b389a 100644 --- a/common/luaobject.h +++ b/common/luaobject.h @@ -23,6 +23,7 @@ #define AWESOME_COMMON_LUAOBJECT #include "common/luaclass.h" +#include "luaa.h" #define LUAA_OBJECT_REGISTRY_KEY "awesome.object.registry" @@ -41,7 +42,7 @@ static inline void * luaA_object_ref_item(lua_State *L, int ud, int iud) { /* Get the env table from the object */ - lua_getfenv(L, ud); + luaA_getuservalue(L, ud); void *pointer = luaA_object_incref(L, -1, iud < 0 ? iud - 1 : iud); /* Remove env table */ lua_pop(L, 1); @@ -57,7 +58,7 @@ static inline void luaA_object_unref_item(lua_State *L, int ud, void *pointer) { /* Get the env table from the object */ - lua_getfenv(L, ud); + luaA_getuservalue(L, ud); /* Decrement */ luaA_object_decref(L, -1, pointer); /* Remove env table */ @@ -74,7 +75,7 @@ static inline int luaA_object_push_item(lua_State *L, int ud, void *pointer) { /* Get env table of the object */ - lua_getfenv(L, ud); + luaA_getuservalue(L, ud); /* Push key */ lua_pushlightuserdata(L, pointer); /* Get env.pointer */ @@ -172,7 +173,7 @@ int luaA_object_emit_signal_simple(lua_State *); lua_newtable(L); \ lua_newtable(L); \ lua_setmetatable(L, -2); \ - lua_setfenv(L, -2); \ + luaA_setuservalue(L, -2); \ lua_pushvalue(L, -1); \ /** @todo This is wrong we shouldn't copy the existing signals from */ \ /* the class, but I'm too lazy for doing this correctly right now. */ \ diff --git a/common/version.c b/common/version.c index 6295bf9..bbca1e4 100644 --- a/common/version.c +++ b/common/version.c @@ -50,7 +50,7 @@ eprint_version(void) #endif printf(" (%s@%s)\n", AWESOME_COMPILE_BY, AWESOME_COMPILE_HOSTNAME); - lua_State *L = lua_open(); + lua_State *L = luaL_newstate(); luaopen_base(L); lua_getglobal(L, "_VERSION"); printf(" • Compiled against " LUA_RELEASE diff --git a/dbus.c b/dbus.c index 48676f5..30e2809 100644 --- a/dbus.c +++ b/dbus.c @@ -276,7 +276,7 @@ a_dbus_convert_value(lua_State *L, int idx, DBusMessageIter *iter) type + 1, &subiter); - int arraylen = lua_objlen(L, idx + 1); + int arraylen = luaA_rawlen(L, idx + 1); if(arraylen % 2 != 0) { @@ -789,7 +789,7 @@ luaA_dbus_disconnect_signal(lua_State *L) return 0; } -const struct luaL_reg awesome_dbus_lib[] = +const struct luaL_Reg awesome_dbus_lib[] = { { "request_name", luaA_dbus_request_name }, { "release_name", luaA_dbus_release_name }, diff --git a/keygrabber.c b/keygrabber.c index 97beef6..ccf5bb4 100644 --- a/keygrabber.c +++ b/keygrabber.c @@ -142,7 +142,7 @@ luaA_keygrabber_isrunning(lua_State *L) return 1; } -const struct luaL_reg awesome_keygrabber_lib[] = +const struct luaL_Reg awesome_keygrabber_lib[] = { { "run", luaA_keygrabber_run }, { "stop", luaA_keygrabber_stop }, diff --git a/luaa.c b/luaa.c index 30f2998..d206c26 100644 --- a/luaa.c +++ b/luaa.c @@ -48,15 +48,15 @@ #include "common/backtrace.h" #ifdef WITH_DBUS -extern const struct luaL_reg awesome_dbus_lib[]; +extern const struct luaL_Reg awesome_dbus_lib[]; #endif -extern const struct luaL_reg awesome_keygrabber_lib[]; -extern const struct luaL_reg awesome_mousegrabber_lib[]; -extern const struct luaL_reg awesome_root_lib[]; -extern const struct luaL_reg awesome_mouse_methods[]; -extern const struct luaL_reg awesome_mouse_meta[]; -extern const struct luaL_reg awesome_screen_methods[]; -extern const struct luaL_reg awesome_screen_meta[]; +extern const struct luaL_Reg awesome_keygrabber_lib[]; +extern const struct luaL_Reg awesome_mousegrabber_lib[]; +extern const struct luaL_Reg awesome_root_lib[]; +extern const struct luaL_Reg awesome_mouse_methods[]; +extern const struct luaL_Reg awesome_mouse_meta[]; +extern const struct luaL_Reg awesome_screen_methods[]; +extern const struct luaL_Reg awesome_screen_meta[]; /** Path to config file */ static char *conffile; @@ -271,27 +271,22 @@ luaA_fixups(lua_State *L) lua_setfield(L, -2, "wlen"); lua_pop(L, 1); /* replace next */ - lua_pushliteral(L, "next"); lua_pushcfunction(L, luaAe_next); - lua_settable(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "next"); /* replace pairs */ - lua_pushliteral(L, "pairs"); lua_pushcfunction(L, luaAe_next); lua_pushcclosure(L, luaAe_pairs, 1); /* pairs get next as upvalue */ - lua_settable(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "pairs"); /* replace ipairs */ - lua_pushliteral(L, "ipairs"); lua_pushcfunction(L, luaA_ipairs_aux); lua_pushcclosure(L, luaAe_ipairs, 1); - lua_settable(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "ipairs"); /* replace type */ - lua_pushliteral(L, "type"); lua_pushcfunction(L, luaAe_type); - lua_settable(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "type"); /* set selection */ - lua_pushliteral(L, "selection"); lua_pushcfunction(L, luaA_selection_get); - lua_settable(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "selection"); } /** Look for an item: table, function, etc. @@ -521,7 +516,7 @@ void luaA_init(xdgHandle* xdg) { lua_State *L; - static const struct luaL_reg awesome_lib[] = + static const struct luaL_Reg awesome_lib[] = { { "quit", luaA_quit }, { "exec", luaA_exec }, @@ -554,22 +549,22 @@ luaA_init(xdgHandle* xdg) luaA_openlib(L, "awesome", awesome_lib, awesome_lib); /* Export root lib */ - luaL_register(L, "root", awesome_root_lib); - lua_pop(L, 1); /* luaL_register() leaves the table on stack */ + luaA_registerlib(L, "root", awesome_root_lib); + lua_pop(L, 1); /* luaA_registerlib() leaves the table on stack */ #ifdef WITH_DBUS /* Export D-Bus lib */ - luaL_register(L, "dbus", awesome_dbus_lib); - lua_pop(L, 1); /* luaL_register() leaves the table on stack */ + luaA_registerlib(L, "dbus", awesome_dbus_lib); + lua_pop(L, 1); /* luaA_registerlib() leaves the table on stack */ #endif /* Export keygrabber lib */ - luaL_register(L, "keygrabber", awesome_keygrabber_lib); - lua_pop(L, 1); /* luaL_register() leaves the table on stack */ + luaA_registerlib(L, "keygrabber", awesome_keygrabber_lib); + lua_pop(L, 1); /* luaA_registerlib() leaves the table on stack */ /* Export mousegrabber lib */ - luaL_register(L, "mousegrabber", awesome_mousegrabber_lib); - lua_pop(L, 1); /* luaL_register() leaves the table on stack */ + luaA_registerlib(L, "mousegrabber", awesome_mousegrabber_lib); + lua_pop(L, 1); /* luaA_registerlib() leaves the table on stack */ /* Export screen */ luaA_openlib(L, "screen", awesome_screen_methods, awesome_screen_meta); @@ -600,13 +595,13 @@ luaA_init(xdgHandle* xdg) /* add Lua search paths */ lua_getglobal(L, "package"); - if (LUA_TTABLE != lua_type(L, 1)) + if (LUA_TTABLE != lua_type(L, -1)) { warn("package is not a table"); return; } - lua_getfield(L, 1, "path"); - if (LUA_TSTRING != lua_type(L, 2)) + lua_getfield(L, -1, "path"); + if (LUA_TSTRING != lua_type(L, -1)) { warn("package.path is not a string"); lua_pop(L, 1); @@ -635,9 +630,9 @@ luaA_init(xdgHandle* xdg) lua_pushliteral(L, ";" AWESOME_LUA_LIB_PATH "/?.lua"); lua_pushliteral(L, ";" AWESOME_LUA_LIB_PATH "/?/init.lua"); lua_concat(L, 3); /* concatenate with package.path */ - lua_setfield(L, 1, "path"); /* package.path = "concatenated string" */ + lua_setfield(L, -2, "path"); /* package.path = "concatenated string" */ - lua_getfield(L, 1, "loaded"); + lua_getfield(L, -1, "loaded"); lua_pop(L, 2); /* pop "package" and "package.loaded" */ diff --git a/luaa.h b/luaa.h index 151b2eb..d871964 100644 --- a/luaa.h +++ b/luaa.h @@ -47,11 +47,86 @@ luaL_error(L, "invalid screen number: %d", screen + 1); \ } while(0) +/** Print a warning about some Lua code. + * This is less mean than luaL_error() which setjmp via lua_error() and kills + * everything. This only warn, it's up to you to then do what's should be done. + * \param L The Lua VM state. + * \param fmt The warning message. + */ +static inline void __attribute__ ((format(printf, 2, 3))) +luaA_warn(lua_State *L, const char *fmt, ...) +{ + va_list ap; + luaL_where(L, 1); + fprintf(stderr, "%sW: ", lua_tostring(L, -1)); + lua_pop(L, 1); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + +static inline int +luaA_typerror(lua_State *L, int narg, const char *tname) +{ + const char *msg = lua_pushfstring(L, "%s expected, got %s", + tname, luaL_typename(L, narg)); + return luaL_argerror(L, narg, msg); +} + +static inline void +luaA_getuservalue(lua_State *L, int idx) +{ +#if LUA_VERSION_NUM >= 502 + lua_getuservalue(L, idx); +#else + lua_getfenv(L, idx); +#endif +} + +static inline void +luaA_setuservalue(lua_State *L, int idx) +{ +#if LUA_VERSION_NUM >= 502 + lua_setuservalue(L, idx); +#else + lua_setfenv(L, idx); +#endif +} + +static inline size_t +luaA_rawlen(lua_State *L, int idx) +{ +#if LUA_VERSION_NUM >= 502 + return lua_rawlen(L, idx); +#else + return lua_objlen(L, idx); +#endif +} + +static inline void +luaA_registerlib(lua_State *L, const char *libname, const luaL_Reg *l) +{ +#if LUA_VERSION_NUM >= 502 + if (libname) + { + lua_newtable(L); + luaL_setfuncs(L, l, 0); + lua_pushvalue(L, -1); + lua_setglobal(L, libname); + } + else + luaL_setfuncs(L, l, 0); +#else + luaL_register(L, libname, l); +#endif +} + static inline bool luaA_checkboolean(lua_State *L, int n) { if(!lua_isboolean(L, n)) - luaL_typerror(L, n, "boolean"); + luaA_typerror(L, n, "boolean"); return lua_toboolean(L, n); } @@ -167,25 +242,6 @@ luaA_dofunction_from_registry(lua_State *L, int ref, int nargs, int nret) return luaA_dofunction(L, nargs, nret); } -/** Print a warning about some Lua code. - * This is less mean than luaL_error() which setjmp via lua_error() and kills - * everything. This only warn, it's up to you to then do what's should be done. - * \param L The Lua VM state. - * \param fmt The warning message. - */ -static inline void __attribute__ ((format(printf, 2, 3))) -luaA_warn(lua_State *L, const char *fmt, ...) -{ - va_list ap; - luaL_where(L, 1); - fprintf(stderr, "%sW: ", lua_tostring(L, -1)); - lua_pop(L, 1); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "\n"); -} - void luaA_init(xdgHandle *); bool luaA_parserc(xdgHandle *, const char *, bool); bool luaA_hasitem(lua_State *, const void *); diff --git a/mouse.c b/mouse.c index 732baac..db802d9 100644 --- a/mouse.c +++ b/mouse.c @@ -225,7 +225,7 @@ luaA_mouse_object_under_pointer(lua_State *L) return 0; } -const struct luaL_reg awesome_mouse_methods[] = +const struct luaL_Reg awesome_mouse_methods[] = { { "__index", luaA_mouse_index }, { "__newindex", luaA_mouse_newindex }, @@ -233,7 +233,7 @@ const struct luaL_reg awesome_mouse_methods[] = { "object_under_pointer", luaA_mouse_object_under_pointer }, { NULL, NULL } }; -const struct luaL_reg awesome_mouse_meta[] = +const struct luaL_Reg awesome_mouse_meta[] = { { NULL, NULL } }; diff --git a/mousegrabber.c b/mousegrabber.c index e8685fc..50afe12 100644 --- a/mousegrabber.c +++ b/mousegrabber.c @@ -123,7 +123,7 @@ luaA_mousegrabber_isrunning(lua_State *L) return 1; } -const struct luaL_reg awesome_mousegrabber_lib[] = +const struct luaL_Reg awesome_mousegrabber_lib[] = { { "run", luaA_mousegrabber_run }, { "stop", luaA_mousegrabber_stop }, diff --git a/objects/button.c b/objects/button.c index 152b75c..4eac0fc 100644 --- a/objects/button.c +++ b/objects/button.c @@ -99,14 +99,14 @@ luaA_button_set_button(lua_State *L, button_t *b) void button_class_setup(lua_State *L) { - static const struct luaL_reg button_methods[] = + static const struct luaL_Reg button_methods[] = { LUA_CLASS_METHODS(button) { "__call", luaA_button_new }, { NULL, NULL } }; - static const struct luaL_reg button_meta[] = + static const struct luaL_Reg button_meta[] = { LUA_OBJECT_META(button) LUA_CLASS_META diff --git a/objects/client.c b/objects/client.c index 1fbbbf1..a5b9d77 100644 --- a/objects/client.c +++ b/objects/client.c @@ -1648,7 +1648,7 @@ client_checker(client_t *c) void client_class_setup(lua_State *L) { - static const struct luaL_reg client_methods[] = + static const struct luaL_Reg client_methods[] = { LUA_CLASS_METHODS(client) { "get", luaA_client_get }, @@ -1657,7 +1657,7 @@ client_class_setup(lua_State *L) { NULL, NULL } }; - static const struct luaL_reg client_meta[] = + static const struct luaL_Reg client_meta[] = { LUA_OBJECT_META(client) LUA_CLASS_META diff --git a/objects/drawin.c b/objects/drawin.c index d4770bd..9e8f01c 100644 --- a/objects/drawin.c +++ b/objects/drawin.c @@ -554,14 +554,14 @@ luaA_drawin_refresh(lua_State *L) void drawin_class_setup(lua_State *L) { - static const struct luaL_reg drawin_methods[] = + static const struct luaL_Reg drawin_methods[] = { LUA_CLASS_METHODS(drawin) { "__call", luaA_drawin_new }, { NULL, NULL } }; - static const struct luaL_reg drawin_meta[] = + static const struct luaL_Reg drawin_meta[] = { LUA_OBJECT_META(drawin) LUA_CLASS_META diff --git a/objects/key.c b/objects/key.c index 861275c..af0d707 100644 --- a/objects/key.c +++ b/objects/key.c @@ -142,7 +142,7 @@ uint16_t luaA_tomodifiers(lua_State *L, int ud) { luaA_checktable(L, ud); - ssize_t len = lua_objlen(L, ud); + ssize_t len = luaA_rawlen(L, ud); uint16_t mod = XCB_NONE; for(int i = 1; i <= len; i++) { @@ -203,14 +203,14 @@ luaA_key_set_key(lua_State *L, keyb_t *k) void key_class_setup(lua_State *L) { - static const struct luaL_reg key_methods[] = + static const struct luaL_Reg key_methods[] = { LUA_CLASS_METHODS(key) { "__call", luaA_key_new }, { NULL, NULL } }; - static const struct luaL_reg key_meta[] = + static const struct luaL_Reg key_meta[] = { LUA_OBJECT_META(key) LUA_CLASS_META diff --git a/objects/tag.c b/objects/tag.c index b63dcd5..9a8d543 100644 --- a/objects/tag.c +++ b/objects/tag.c @@ -406,14 +406,14 @@ luaA_tag_get_screen(lua_State *L, tag_t *tag) void tag_class_setup(lua_State *L) { - static const struct luaL_reg tag_methods[] = + static const struct luaL_Reg tag_methods[] = { LUA_CLASS_METHODS(tag) { "__call", luaA_tag_new }, { NULL, NULL } }; - static const struct luaL_reg tag_meta[] = + static const struct luaL_Reg tag_meta[] = { LUA_OBJECT_META(tag) LUA_CLASS_META diff --git a/objects/timer.c b/objects/timer.c index 64384f2..2550023 100644 --- a/objects/timer.c +++ b/objects/timer.c @@ -121,14 +121,14 @@ LUA_OBJECT_EXPORT_PROPERTY(timer, atimer_t, started, lua_pushboolean) void timer_class_setup(lua_State *L) { - static const struct luaL_reg timer_methods[] = + static const struct luaL_Reg timer_methods[] = { LUA_CLASS_METHODS(timer) { "__call", luaA_timer_new }, { NULL, NULL } }; - static const struct luaL_reg timer_meta[] = + static const struct luaL_Reg timer_meta[] = { LUA_OBJECT_META(timer) LUA_CLASS_META diff --git a/objects/window.c b/objects/window.c index 02e5ace..691335d 100644 --- a/objects/window.c +++ b/objects/window.c @@ -351,12 +351,12 @@ LUA_OBJECT_EXPORT_PROPERTY(window, window_t, border_width, lua_pushnumber) void window_class_setup(lua_State *L) { - static const struct luaL_reg window_methods[] = + static const struct luaL_Reg window_methods[] = { { NULL, NULL } }; - static const struct luaL_reg window_meta[] = + static const struct luaL_Reg window_meta[] = { { "struts", luaA_window_struts }, { "buttons", luaA_window_buttons }, diff --git a/root.c b/root.c index a1aeb2b..8736a29 100644 --- a/root.c +++ b/root.c @@ -287,7 +287,7 @@ luaA_root_wallpaper(lua_State *L) return 1; } -const struct luaL_reg awesome_root_lib[] = +const struct luaL_Reg awesome_root_lib[] = { { "buttons", luaA_root_buttons }, { "keys", luaA_root_keys }, diff --git a/screen.c b/screen.c index 3dc70d4..6fa1777 100644 --- a/screen.c +++ b/screen.c @@ -662,14 +662,14 @@ luaA_screen_count(lua_State *L) return 1; } -const struct luaL_reg awesome_screen_methods[] = +const struct luaL_Reg awesome_screen_methods[] = { { "count", luaA_screen_count }, { "__index", luaA_screen_module_index }, { NULL, NULL } }; -const struct luaL_reg awesome_screen_meta[] = +const struct luaL_Reg awesome_screen_meta[] = { { "add_signal", luaA_screen_add_signal }, { "connect_signal", luaA_screen_connect_signal }, -- To unsubscribe, send mail to [email protected].
