MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / luaL_newmetatable

Function luaL_newmetatable

lua/lauxlib.c:144–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142
143
144LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
145 lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */
146 if (!lua_isnil(L, -1)) /* name already in use? */
147 return 0; /* leave previous value on top, but return 0 */
148 lua_pop(L, 1);
149 lua_newtable(L); /* create metatable */
150 lua_pushvalue(L, -1);
151 lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */
152 return 1;
153}
154
155
156LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {

Callers 15

init_cstringFunction · 0.85
init_datetimeFunction · 0.85
init_intervalymFunction · 0.85
init_intervaldsFunction · 0.85
init_blobFunction · 0.85
init_intFunction · 0.85
init_realFunction · 0.85
init_decimalFunction · 0.85
init_db_funcsFunction · 0.85
init_dbtable_funcsFunction · 0.85
init_dbstmt_funcsFunction · 0.85
init_dbthread_funcsFunction · 0.85

Calls 3

lua_getfieldFunction · 0.85
lua_pushvalueFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected