MCPcopy Create free account
hub / github.com/axmolengine/axmol / main

Function main

3rdparty/lua/plainlua/lua.c:670–686  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

668
669
670int main (int argc, char **argv) {
671 int status, result;
672 lua_State *L = luaL_newstate(); /* create state */
673 if (L == NULL) {
674 l_message(argv[0], "cannot create state: not enough memory");
675 return EXIT_FAILURE;
676 }
677 lua_gc(L, LUA_GCSTOP); /* stop GC while building state */
678 lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */
679 lua_pushinteger(L, argc); /* 1st argument */
680 lua_pushlightuserdata(L, argv); /* 2nd argument */
681 status = lua_pcall(L, 2, 1, 0); /* do the call */
682 result = lua_toboolean(L, -1); /* get result */
683 report(L, status);
684 lua_close(L);
685 return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
686}
687

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected