| 842 | } |
| 843 | |
| 844 | void* CheckUserType(lua_State* L, int user_data_index, uint32_t type_hash, const char* error_message) |
| 845 | { |
| 846 | void* result = ToUserType(L, user_data_index, type_hash); |
| 847 | if (result == 0) |
| 848 | { |
| 849 | if (error_message == 0x0) { |
| 850 | const char* type = (const char*)dmHashReverse32(type_hash, 0); |
| 851 | luaL_typerror(L, user_data_index, type); |
| 852 | } |
| 853 | else { |
| 854 | luaL_error(L, "%s", error_message); |
| 855 | } |
| 856 | } |
| 857 | return result; |
| 858 | } |
| 859 | |
| 860 | static bool GetMetaFunction(lua_State* L, int index, const char* meta_table_key, size_t meta_table_key_length) { |
| 861 | if (lua_getmetatable(L, index)) { |