From ffaf456654bdf836526771801d64c6d85f4c7a54 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 5 Nov 2021 12:03:27 -0700 Subject: ohh, that word 'index' was key --- src/lcurseslib.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/lcurseslib.c b/src/lcurseslib.c index 042c7d8..ce8ec0e 100644 --- a/src/lcurseslib.c +++ b/src/lcurseslib.c @@ -112,6 +112,10 @@ static const luaL_Reg curses_window_methods[] = LUALIB_API int luaopen_curses (lua_State *L) { luaL_newmetatable(L, "curses:window"); + /* metatable.__index = metatable */ + lua_pushstring(L, "__index"); + lua_pushvalue(L, -2); + lua_settable(L, -3); luaL_register(L, NULL, curses_window_methods); luaL_register(L, "curses", curseslib); /* save main window on registry */ -- cgit 1.4.1-2-gfad0