LUAL_NEWMETATABLE(3) Library Functions Manual LUAL_NEWMETATABLE(3)

luaL_newmetatablecreates a new table to be used as a metatable for userdata, function indicator [-0, +1, m]

#include <lauxlib.h>

int
luaL_newmetatable(lua_State *L, const char *tname);

If the registry already has the key tname, returns 0. Otherwise, creates a new table to be used as a metatable for userdata, adds it to the registry with key tname, and returns 1.

In both cases pushes onto the stack the final value associated with tname in the registry.

Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, Lua 5.1 Reference Manual.

The luaL_newmetatable() manual page is based on Lua Reference Manual 5.1 and was created by Sergey Bronnikov.

July 26, 2022 Debian