예제 #1
0
static int lpi_processThunk(int n, void * L)
{
    lua_settop(L, 0);
    lua_getglobal(L, "debug");
    lua_getfield(L, 1, "traceback");
    lua_remove(L, 1);
    
    lua_rawgeti(L, LUA_REGISTRYINDEX, n);   /* dtb self */
    luaL_checkudata(L, 2, "PI_PROCESS *");

    lua_getfenv(L, 2);                      /* dtb self env */
    lua_getfield(L, 3, "__process");        /* dtb self env fn */
    lua_insert(L, 2);                       /* dtb fn self env */
    
    int nargs = lua_objlen(L, 4)+1;

    l_unpack(L, 4);                        /* dtb fn self env ... */
    lua_remove(L, 4);                      /* dtb fn self ... */
    
    int rv;
    if ((rv = lua_pcall(L, nargs, 1, 1)) != 0)
    {
        PI_Abort(0, lua_tostring(L, -1), __FILE__, __LINE__);
        return rv;
    }
    
    rv = lua_tointeger(L, -1);
    return rv;
}
예제 #2
0
파일: pal.c 프로젝트: andrewdownie/CIS3090
/*
	Function to allow consistant way of exiting the program when an error is encountered.
*/
int ExitFailure(char *exitMessage, char *file, int line){
	printf("\nERROR: %s\n\n", exitMessage);
	PI_Abort(EXIT_FAILURE, ", Error: No input file specified.", file, line);
	return EXIT_FAILURE;
}