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

Function main1

src/Chain/libraries/glua/lua.cpp:594–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592
593
594int main1(int argc, char **argv) {
595 /*
596 argc = 2;
597 argv = (char**)malloc(sizeof(char*) * 2);
598 argv[0] = "lua";
599 argv[1] = "sample.bytes";
600 */
601 int status, result;
602 lua_State *L = luaL_newstate(); /* create state */
603 if (L == nullptr) {
604 l_message(argv[0], "cannot create state: not enough memory");
605 return EXIT_FAILURE;
606 }
607 lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */
608 lua_pushinteger(L, argc); /* 1st argument */
609 lua_pushlightuserdata(L, argv); /* 2nd argument */
610 status = lua_pcall(L, 2, 1, 0); /* do the call */
611 result = lua_toboolean(L, -1); /* get result */
612 report(L, status);
613 lua_close(L);
614 return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
615}
616

Callers

nothing calls this directly

Calls 7

luaL_newstateFunction · 0.85
lua_pushintegerFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_tobooleanFunction · 0.85
lua_closeFunction · 0.85
l_messageFunction · 0.70
reportFunction · 0.70

Tested by

no test coverage detected