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