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

Function pmain

3rd/lua-5.4.3/src/luac.c:169–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected