diff options
Diffstat (limited to 'src/script/common')
-rw-r--r-- | src/script/common/c_internal.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/script/common/c_internal.h b/src/script/common/c_internal.h index ecb514c8f..80576b5e9 100644 --- a/src/script/common/c_internal.h +++ b/src/script/common/c_internal.h @@ -34,6 +34,27 @@ extern "C" { #include "common/c_types.h" + +/* + Define our custom indices into the Lua registry table. + + Lua 5.2 and above define the LUA_RIDX_LAST macro. Only numbers above that + may be used for custom indices, anything else is reserved. + + Lua 5.1 / LuaJIT do not use any numeric indices (only string indices), + so we can use numeric indices freely. +*/ +#ifdef LUA_RIDX_LAST +#define CUSTOM_RIDX_BASE ((LUA_RIDX_LAST)+1) +#else +#define CUSTOM_RIDX_BASE 1 +#endif + +#define CUSTOM_RIDX_SCRIPTAPI (CUSTOM_RIDX_BASE) +#define CUSTOM_RIDX_GLOBALS_BACKUP (CUSTOM_RIDX_BASE + 1) +#define CUSTOM_RIDX_CURRENT_MOD_NAME (CUSTOM_RIDX_BASE + 2) + + #define PCALL_RESL(L, RES) do { \ int result_ = (RES); \ if (result_ != 0) { \ |