MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / pmain

Function pmain

third-party/lua-5.2.4/src/luac.c:162–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

luaL_loadfileFunction · 0.85
lua_touserdataFunction · 0.70
lua_checkstackFunction · 0.70
fatalFunction · 0.70
combineFunction · 0.70
cannotFunction · 0.70
luaU_dumpFunction · 0.70
lua_tointegerFunction · 0.50

Tested by

no test coverage detected