MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / pmain

Function pmain

xrepo/packages/l/lua/port/lua/src/luac.c:170–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170static int pmain(lua_State* L)
171{
172 int argc=(int)lua_tointeger(L,1);
173 char** argv=(char**)lua_touserdata(L,2);
174 const Proto* f;
175 int i;
176 tmname=G(L)->tmname;
177 if (!lua_checkstack(L,argc)) fatal("too many input files");
178 for (i=0; i<argc; i++)
179 {
180 const char* filename=IS("-") ? NULL : argv[i];
181 if (luaL_loadfile(L,filename)!=LUA_OK) fatal(lua_tostring(L,-1));
182 }
183 f=combine(L,argc);
184 if (listing) luaU_print(f,listing>1);
185 if (dumping)
186 {
187 FILE* D= (output==NULL) ? stdout : fopen(output,"wb");
188 if (D==NULL) cannot("open");
189 lua_lock(L);
190 luaU_dump(L,f,writer,D,stripping);
191 lua_unlock(L);
192 if (ferror(D)) cannot("write");
193 if (fclose(D)) cannot("close");
194 }
195 return 0;
196}
197
198int main(int argc, char* argv[])
199{

Callers

nothing calls this directly

Calls 6

fatalFunction · 0.85
cannotFunction · 0.85
luaU_dumpFunction · 0.85
lua_touserdataFunction · 0.70
lua_checkstackFunction · 0.70
combineFunction · 0.70

Tested by

no test coverage detected