MCPcopy Create free account
hub / github.com/apache/thrift / set_methods

Function set_methods

lib/lua/src/luasocket.c:159–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159static void set_methods(lua_State *L,
160 const char *metatablename,
161 const struct luaL_Reg *methods) {
162 luaL_getmetatable(L, metatablename); // mt
163 // Create the __index table
164 lua_pushstring(L, "__index"); // mt, "__index"
165 lua_newtable(L); // mt, "__index", t
166 for (; methods->name; methods++) {
167 lua_pushstring(L, methods->name); // mt, "__index", t, "name"
168 lua_pushcfunction(L, methods->func); // mt, "__index", t, "name", func
169 lua_rawset(L, -3); // mt, "__index", t
170 }
171 lua_rawset(L, -3); // mt
172 lua_pop(L, 1);
173}
174
175int luaopen_libluasocket(lua_State *L) {
176 luaL_newmetatable(L, SOCKET_GENERIC);

Callers 1

luaopen_libluasocketFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected