MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / lua_load

Function lua_load

3rd/lua-5.4.3/src/lapi.c:1080–1100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1078
1079
1080LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
1081 const char *chunkname, const char *mode) {
1082 ZIO z;
1083 int status;
1084 lua_lock(L);
1085 if (!chunkname) chunkname = "?";
1086 luaZ_init(L, &z, reader, data);
1087 status = luaD_protectedparser(L, &z, chunkname, mode);
1088 if (status == LUA_OK) { /* no errors? */
1089 LClosure *f = clLvalue(s2v(L->top - 1)); /* get newly created function */
1090 if (f->nupvalues >= 1) { /* does it have an upvalue? */
1091 /* get global table from registry */
1092 const TValue *gt = getGtable(L);
1093 /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
1094 setobj(L, f->upvals[0]->v, gt);
1095 luaC_barrier(L, f->upvals[0], gt);
1096 }
1097 }
1098 lua_unlock(L);
1099 return status;
1100}
1101
1102
1103LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) {

Callers 4

luaB_loadFunction · 0.85
luaL_loadfilexFunction · 0.85
luaL_loadbufferxFunction · 0.85
combineFunction · 0.85

Calls 2

luaZ_initFunction · 0.85
luaD_protectedparserFunction · 0.85

Tested by

no test coverage detected