1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Use enum to define custom registry indices

This commit is contained in:
Jude Melton-Houghton 2022-10-12 14:06:41 -04:00
parent f073e37d2f
commit f7ae70c3d9

View file

@ -44,19 +44,21 @@ extern "C" {
Lua 5.1 / LuaJIT do not use any numeric indices (only string indices), Lua 5.1 / LuaJIT do not use any numeric indices (only string indices),
so we can use numeric indices freely. so we can use numeric indices freely.
*/ */
enum {
#ifdef LUA_RIDX_LAST #ifdef LUA_RIDX_LAST
#define CUSTOM_RIDX_BASE ((LUA_RIDX_LAST)+1) CUSTOM_RIDX_BEFORE_ = LUA_RIDX_LAST,
#else #else
#define CUSTOM_RIDX_BASE 1 CUSTOM_RIDX_BEFORE_ = 0,
#endif #endif
#define CUSTOM_RIDX_SCRIPTAPI (CUSTOM_RIDX_BASE) CUSTOM_RIDX_SCRIPTAPI,
#define CUSTOM_RIDX_GLOBALS_BACKUP (CUSTOM_RIDX_BASE + 1) CUSTOM_RIDX_GLOBALS_BACKUP,
#define CUSTOM_RIDX_CURRENT_MOD_NAME (CUSTOM_RIDX_BASE + 2) CUSTOM_RIDX_CURRENT_MOD_NAME,
#define CUSTOM_RIDX_BACKTRACE (CUSTOM_RIDX_BASE + 3) CUSTOM_RIDX_BACKTRACE,
#define CUSTOM_RIDX_HTTP_API_LUA (CUSTOM_RIDX_BASE + 4) CUSTOM_RIDX_HTTP_API_LUA,
#define CUSTOM_RIDX_VECTOR_METATABLE (CUSTOM_RIDX_BASE + 5) CUSTOM_RIDX_VECTOR_METATABLE,
#define CUSTOM_RIDX_METATABLE_MAP (CUSTOM_RIDX_BASE + 6) CUSTOM_RIDX_METATABLE_MAP,
};
// Determine if CUSTOM_RIDX_SCRIPTAPI will hold a light or full userdata // Determine if CUSTOM_RIDX_SCRIPTAPI will hold a light or full userdata