PPaste!

Home - All the pastes - Authored by Thooms

Raw version

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
int pmain(lua_State *L) {
    int status;

    luaL_checkversion(L);

    while (true) {
        status = luaL_loadfile(L, MAIN_SCRIPT);
        if (status == LUA_OK)
            status = lua_pcall(L, 0, LUA_MULTRET, 0);

        if (status == LUA_OK)
            break;

        printf("Error: %s\n", lua_tostring(L, -1));
        lua_pop(L, 1);

        getchar();
    }

    return 1;
}