lua_State* state = luaL_newstate(); lua_setallocf(state, &CustomAllocator::lua_Alloc, &alloc); lua_close(state);
luaL_newstate is from the aux library, use lua_newstate() instead. - Alex