MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / lua_load

Function lua_load

ThirdParty/lua/lua/lapi.c:963–984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961
962
963LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
964 const char *chunkname, const char *mode) {
965 ZIO z;
966 int status;
967 lua_lock(L);
968 if (!chunkname) chunkname = "?";
969 luaZ_init(L, &z, reader, data);
970 status = luaD_protectedparser(L, &z, chunkname, mode);
971 if (status == LUA_OK) { /* no errors? */
972 LClosure *f = clLvalue(L->top - 1); /* get newly created function */
973 if (f->nupvalues >= 1) { /* does it have an upvalue? */
974 /* get global table from registry */
975 Table *reg = hvalue(&G(L)->l_registry);
976 const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
977 /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
978 setobj(L, f->upvals[0]->v, gt);
979 luaC_upvalbarrier(L, f->upvals[0]);
980 }
981 }
982 lua_unlock(L);
983 return status;
984}
985
986
987LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) {

Callers 3

luaB_loadFunction · 0.85
luaL_loadfilexFunction · 0.85
luaL_loadbufferxFunction · 0.85

Calls 4

luaZ_initFunction · 0.85
luaD_protectedparserFunction · 0.85
luaH_getintFunction · 0.85
GFunction · 0.50

Tested by

no test coverage detected