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

Function runargs

src/Chain/libraries/glua/lrepl.cpp:237–254  ·  view source on GitHub ↗

** Processes options 'e' and 'l', which involve running Lua code. ** Returns 0 if some code raises an error. */

Source from the content-addressed store, hash-verified

235** Returns 0 if some code raises an error.
236*/
237static int runargs(lua_State *L, char **argv, int n) {
238 int i;
239 for (i = 1; i < n; i++) {
240 int option = argv[i][1];
241 lua_assert(argv[i][0] == '-'); /* already checked */
242 if (option == 'e' || option == 'l') {
243 int status;
244 const char *extra = argv[i] + 2; /* both options need an argument */
245 if (*extra == '\0') extra = argv[++i];
246 lua_assert(extra != nullptr);
247 status = (option == 'e')
248 ? dostring(L, extra, "=(command line)")
249 : dolibrary(L, extra);
250 if (status != LUA_OK) return 0;
251 }
252 }
253 return 1;
254}
255
256static int handle_script(lua_State *L, char **argv) {
257 // READ THIS

Callers

nothing calls this directly

Calls 2

dostringFunction · 0.70
dolibraryFunction · 0.70

Tested by

no test coverage detected