diff --git a/dbus.c b/dbus.c index 5bc7e93b..94b83864 100644 --- a/dbus.c +++ b/dbus.c @@ -797,6 +797,8 @@ const struct luaL_Reg awesome_dbus_lib[] = { "remove_match", luaA_dbus_remove_match }, { "connect_signal", luaA_dbus_connect_signal }, { "disconnect_signal", luaA_dbus_disconnect_signal }, + { "__index", luaA_default_index }, + { "__newindex", luaA_default_newindex }, { NULL, NULL } }; diff --git a/keygrabber.c b/keygrabber.c index ccf5bb45..c56bae6f 100644 --- a/keygrabber.c +++ b/keygrabber.c @@ -147,6 +147,8 @@ const struct luaL_Reg awesome_keygrabber_lib[] = { "run", luaA_keygrabber_run }, { "stop", luaA_keygrabber_stop }, { "isrunning", luaA_keygrabber_isrunning }, + { "__index", luaA_default_index }, + { "__newindex", luaA_default_newindex }, { NULL, NULL } }; diff --git a/luaa.c b/luaa.c index 01b08d2f..8af1dc01 100644 --- a/luaa.c +++ b/luaa.c @@ -254,7 +254,7 @@ luaA_awesome_index(lua_State *L) return 1; } - return 0; + return luaA_default_index(L); } /** Add a global signal. @@ -361,6 +361,7 @@ luaA_init(xdgHandle* xdg) { "set_xproperty", luaA_set_xproperty }, { "get_xproperty", luaA_get_xproperty }, { "__index", luaA_awesome_index }, + { "__newindex", luaA_default_newindex }, { NULL, NULL } }; @@ -597,4 +598,16 @@ luaA_emit_refresh() signal_object_emit(globalconf.L, &global_signals, "refresh", 0); } +int +luaA_default_index(lua_State *L) +{ + return luaA_class_index_miss_property(L, NULL); +} + +int +luaA_default_newindex(lua_State *L) +{ + return luaA_class_newindex_miss_property(L, NULL); +} + // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/luaa.h b/luaa.h index c92aa61f..79927975 100644 --- a/luaa.h +++ b/luaa.h @@ -210,6 +210,8 @@ signal_array_t global_signals; int luaA_class_index_miss_property(lua_State *, lua_object_t *); int luaA_class_newindex_miss_property(lua_State *, lua_object_t *); +int luaA_default_index(lua_State *); +int luaA_default_newindex(lua_State *); void luaA_systray_invalidate(void); diff --git a/mouse.c b/mouse.c index a78fc7a4..8caf05da 100644 --- a/mouse.c +++ b/mouse.c @@ -106,7 +106,7 @@ luaA_mouse_index(lua_State *L) /* attr is not "screen"?! */ if (A_STRNEQ(attr, "screen")) - return 0; + return luaA_default_index(L); if (!mouse_query_pointer_root(&mouse_x, &mouse_y, NULL, NULL)) { @@ -137,7 +137,7 @@ luaA_mouse_newindex(lua_State *L) int screen; if (A_STRNEQ(attr, "screen")) - return 0; + return luaA_default_newindex(L); screen = luaL_checknumber(L, 3) - 1; luaA_checkscreen(screen); diff --git a/mousegrabber.c b/mousegrabber.c index 35d87dda..fd0a209d 100644 --- a/mousegrabber.c +++ b/mousegrabber.c @@ -140,6 +140,8 @@ const struct luaL_Reg awesome_mousegrabber_lib[] = { "run", luaA_mousegrabber_run }, { "stop", luaA_mousegrabber_stop }, { "isrunning", luaA_mousegrabber_isrunning }, + { "__index", luaA_default_index }, + { "__newindex", luaA_default_newindex }, { NULL, NULL } }; diff --git a/root.c b/root.c index 2dea6349..d6258c3a 100644 --- a/root.c +++ b/root.c @@ -433,6 +433,8 @@ const struct luaL_Reg awesome_root_lib[] = { "drawins", luaA_root_drawins }, { "wallpaper", luaA_root_wallpaper }, { "tags", luaA_root_tags }, + { "__index", luaA_default_index }, + { "__newindex", luaA_default_newindex }, { NULL, NULL } }; diff --git a/screen.c b/screen.c index e04e310b..b5716267 100644 --- a/screen.c +++ b/screen.c @@ -502,7 +502,7 @@ luaA_screen_index(lua_State *L) return 1; } - return 0; + return luaA_default_index(L); } /** Add a signal to a screen. @@ -610,6 +610,7 @@ const struct luaL_Reg awesome_screen_methods[] = { { "count", luaA_screen_count }, { "__index", luaA_screen_module_index }, + { "__newindex", luaA_default_newindex }, { NULL, NULL } }; @@ -620,6 +621,7 @@ const struct luaL_Reg awesome_screen_meta[] = { "disconnect_signal", luaA_screen_disconnect_signal }, { "emit_signal", luaA_screen_emit_signal }, { "__index", luaA_screen_index }, + { "__newindex", luaA_default_newindex }, { NULL, NULL } };