diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-05 11:52:59 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-05 11:52:59 -0700 |
commit | bf7baffa307bd30708f1cb59f8be9a9155887e93 (patch) | |
tree | ff42d7337efed8e2c3d7a1668e643ecac18ab54e /src/lua.c | |
parent | c4c3b93bf5a7fa1844215d6c902c13f9aa9485f7 (diff) | |
download | teliva-bf7baffa307bd30708f1cb59f8be9a9155887e93.tar.gz |
metatables seem to be a separate namespace from globals
Diffstat (limited to 'src/lua.c')
-rw-r--r-- | src/lua.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lua.c b/src/lua.c index a766e65..b6cd675 100644 --- a/src/lua.c +++ b/src/lua.c @@ -387,7 +387,7 @@ static int newarray (lua_State *L) { size_t nbytes = sizeof(NumArray) + n*sizeof(double); NumArray *a = (NumArray *)lua_newuserdata(L, nbytes); - luaL_getmetatable(L, "meta.array"); + luaL_getmetatable(L, "array"); lua_setmetatable(L, -2); a->size = n; @@ -397,7 +397,7 @@ static int newarray (lua_State *L) { /* ensure bottom of stack is an array */ static NumArray *checkarray (lua_State *L) { - void *ud = luaL_checkudata(L, 1, "meta.array"); + void *ud = luaL_checkudata(L, 1, "array"); luaL_argcheck(L, ud != NULL, 1, "`array' expected"); return (NumArray *)ud; } @@ -457,7 +457,7 @@ int main (int argc, char **argv) { l_message(argv[0], "cannot create state: not enough memory"); return EXIT_FAILURE; } - luaL_newmetatable(L, "meta.array"); + luaL_newmetatable(L, "array"); /* stack: metatable */ lua_pushstring(L, "__index"); /* stack: metatable "__index" */ |