MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / luaopen_string

Function luaopen_string

ogsr_engine/LuaJIT/src/lib_string.c:660–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658#include "lj_libdef.h"
659
660LUALIB_API int luaopen_string(lua_State *L)
661{
662 GCtab *mt;
663 global_State *g;
664 LJ_LIB_REG(L, LUA_STRLIBNAME, string);
665#if defined(LUA_COMPAT_GFIND) && !LJ_52
666 lua_getfield(L, -1, "gmatch");
667 lua_setfield(L, -2, "gfind");
668#endif
669 mt = lj_tab_new(L, 0, 1);
670 /* NOBARRIER: basemt is a GC root. */
671 g = G(L);
672 setgcref(basemt_it(g, LJ_TSTR), obj2gco(mt));
673 settabV(L, lj_tab_setstr(L, mt, mmname_str(g, MM_index)), tabV(L->top-1));
674 mt->nomm = (uint8_t)(~(1u<<MM_index));
675#if LJ_HASBUFFER
676 lj_lib_prereg(L, LUA_STRLIBNAME ".buffer", luaopen_string_buffer, tabV(L->top-1));
677#endif
678 return 1;
679}
680

Callers

nothing calls this directly

Calls 5

lj_tab_newFunction · 0.85
lj_tab_setstrFunction · 0.85
lj_lib_preregFunction · 0.85
lua_getfieldFunction · 0.70
lua_setfieldFunction · 0.70

Tested by

no test coverage detected