diff --git a/common/luaclass.c b/common/luaclass.c index 2f8f2b9cf..debfa3694 100644 --- a/common/luaclass.c +++ b/common/luaclass.c @@ -451,6 +451,17 @@ luaA_class_index(lua_State *L) lua_class_property_t *prop = luaA_class_property_get(L, class, 2); + /* Is this the special 'data' property? This is available on all objects and + * thus not implemented as a lua_class_property_t. + */ + if (A_STREQ(attr, "data")) + { + luaA_checkudata(L, 1, class); + luaA_getuservalue(L, 1); + lua_getfield(L, -1, "data"); + return 1; + } + /* Property does exist and has an index callback */ if(prop) { diff --git a/common/luaobject.h b/common/luaobject.h index b57ec43aa..ed6ecb5c7 100644 --- a/common/luaobject.h +++ b/common/luaobject.h @@ -173,6 +173,8 @@ int luaA_object_emit_signal_simple(lua_State *); lua_newtable(L); \ lua_newtable(L); \ lua_setmetatable(L, -2); \ + lua_newtable(L); \ + lua_setfield(L, -2, "data"); \ luaA_setuservalue(L, -2); \ lua_pushvalue(L, -1); \ luaA_class_emit_signal(L, &(lua_class), "new", 1); \