MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / pmain

Function pmain

src/Chain/libraries/glua/luac.cpp:166–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166static int pmain(lua_State* L)
167{
168 int argc = (int)lua_tointeger(L, 1);
169 char** argv = (char**)lua_touserdata(L, 2);
170 const Proto* f;
171 int i;
172 if (!lua_checkstack(L, argc)) fatal("too many input files");
173 for (i = 0; i < argc; i++)
174 {
175 const char* filename = IS("-") ? nullptr : argv[i];
176 if (luaL_loadfile(L, filename) != LUA_OK) fatal(lua_tostring(L, -1));
177 }
178 f = combine(L, argc);
179 if (listing) luaU_print(f, listing > 1);
180 if (dumping)
181 {
182 FILE* D = (output == nullptr) ? stdout : fopen(output, "wb");
183 if (!D)
184 {
185 cannot("open");
186 return 0;
187 }
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 main2(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