1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-02 20:43:35 +00:00

Make userdata hashes 64 bit;

This commit is contained in:
bjorn 2019-11-11 16:38:22 -08:00
parent a7e24ab28e
commit 8d12f0b867
2 changed files with 6 additions and 6 deletions

View file

@ -74,7 +74,7 @@ void _luax_registertype(lua_State* L, const char* name, const luaL_Reg* function
lua_pop(L, 1); lua_pop(L, 1);
} }
void* _luax_totype(lua_State* L, int index, uint32_t hash) { void* _luax_totype(lua_State* L, int index, uint64_t hash) {
Proxy* p = lua_touserdata(L, index); Proxy* p = lua_touserdata(L, index);
if (p && lua_type(L, index) != LUA_TLIGHTUSERDATA && p->hash == hash) { if (p && lua_type(L, index) != LUA_TLIGHTUSERDATA && p->hash == hash) {
@ -84,7 +84,7 @@ void* _luax_totype(lua_State* L, int index, uint32_t hash) {
return NULL; return NULL;
} }
void* _luax_checktype(lua_State* L, int index, uint32_t hash, const char* debug) { void* _luax_checktype(lua_State* L, int index, uint64_t hash, const char* debug) {
void* object = _luax_totype(L, index, hash); void* object = _luax_totype(L, index, hash);
if (!object) { if (!object) {
@ -95,7 +95,7 @@ void* _luax_checktype(lua_State* L, int index, uint32_t hash, const char* debug)
} }
// Registers the userdata on the top of the stack in the registry. // Registers the userdata on the top of the stack in the registry.
void _luax_pushtype(lua_State* L, const char* type, uint32_t hash, void* object) { void _luax_pushtype(lua_State* L, const char* type, uint64_t hash, void* object) {
if (!object) { if (!object) {
lua_pushnil(L); lua_pushnil(L);
return; return;

View file

@ -119,9 +119,9 @@ typedef struct {
#define luax_clearerror(L) lua_pushnil(L), luax_seterror(L) #define luax_clearerror(L) lua_pushnil(L), luax_seterror(L)
void _luax_registertype(lua_State* L, const char* name, const luaL_Reg* functions, void (*destructor)(void*)); void _luax_registertype(lua_State* L, const char* name, const luaL_Reg* functions, void (*destructor)(void*));
void* _luax_totype(lua_State* L, int index, uint32_t hash); void* _luax_totype(lua_State* L, int index, uint64_t hash);
void* _luax_checktype(lua_State* L, int index, uint32_t hash, const char* debug); void* _luax_checktype(lua_State* L, int index, uint64_t hash, const char* debug);
void _luax_pushtype(lua_State* L, const char* name, uint32_t hash, void* object); void _luax_pushtype(lua_State* L, const char* name, uint64_t hash, void* object);
void luax_registerloader(lua_State* L, lua_CFunction loader, int index); void luax_registerloader(lua_State* L, lua_CFunction loader, int index);
void luax_vthrow(void* L, const char* format, va_list args); void luax_vthrow(void* L, const char* format, va_list args);
void luax_traceback(lua_State* L, lua_State* T, const char* message, int level); void luax_traceback(lua_State* L, lua_State* T, const char* message, int level);