MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / main

Function main

3rd/lua-5.4.3/src/lua.c:643–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641
642
643int main (int argc, char **argv) {
644 int status, result;
645 lua_State *L = luaL_newstate(); /* create state */
646 if (L == NULL) {
647 l_message(argv[0], "cannot create state: not enough memory");
648 return EXIT_FAILURE;
649 }
650 lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */
651 lua_pushinteger(L, argc); /* 1st argument */
652 lua_pushlightuserdata(L, argv); /* 2nd argument */
653 status = lua_pcall(L, 2, 1, 0); /* do the call */
654 result = lua_toboolean(L, -1); /* get result */
655 report(L, status);
656 lua_close(L);
657 return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
658}
659

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected