diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:57:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:57:47 +0100 |
commit | 3e16c3a78fff61c20e63ba730d15e94e3bb877b4 (patch) | |
tree | c070350db219f2c4241d22bc31949685c7b42fe9 /src/script/common/c_internal.h | |
parent | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (diff) | |
parent | 6ccb5835ff55d85156be91473c598eca9d6cb9a6 (diff) | |
download | dragonfireclient-3e16c3a78fff61c20e63ba730d15e94e3bb877b4.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/script/common/c_internal.h')
-rw-r--r-- | src/script/common/c_internal.h | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/script/common/c_internal.h b/src/script/common/c_internal.h index 677194453..442546332 100644 --- a/src/script/common/c_internal.h +++ b/src/script/common/c_internal.h @@ -34,6 +34,7 @@ extern "C" { #include "config.h" #include "common/c_types.h" + /* Define our custom indices into the Lua registry table. @@ -44,15 +45,15 @@ extern "C" { so we can use numeric indices freely. */ #ifdef LUA_RIDX_LAST -#define CUSTOM_RIDX_BASE ((LUA_RIDX_LAST) + 1) +#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 CUSTOM_RIDX_BACKTRACE (CUSTOM_RIDX_BASE + 3) +#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 CUSTOM_RIDX_BACKTRACE (CUSTOM_RIDX_BASE + 3) // Determine if CUSTOM_RIDX_SCRIPTAPI will hold a light or full userdata #if defined(__aarch64__) && USE_LUAJIT @@ -64,18 +65,17 @@ extern "C" { #endif // Pushes the error handler onto the stack and returns its index -#define PUSH_ERROR_HANDLER(L) \ +#define PUSH_ERROR_HANDLER(L) \ (lua_rawgeti((L), LUA_REGISTRYINDEX, CUSTOM_RIDX_BACKTRACE), lua_gettop((L))) -#define PCALL_RESL(L, RES) \ - { \ - int result_ = (RES); \ - if (result_ != 0) { \ - script_error((L), result_, NULL, __FUNCTION__); \ - } \ - } +#define PCALL_RESL(L, RES) { \ + int result_ = (RES); \ + if (result_ != 0) { \ + script_error((L), result_, NULL, __FUNCTION__); \ + } \ +} -#define script_run_callbacks(L, nargs, mode) \ +#define script_run_callbacks(L, nargs, mode) \ script_run_callbacks_f((L), (nargs), (mode), __FUNCTION__) // What script_run_callbacks does with the return values of callbacks. @@ -111,7 +111,8 @@ enum RunCallbacksMode std::string script_get_backtrace(lua_State *L); int script_exception_wrapper(lua_State *L, lua_CFunction f); void script_error(lua_State *L, int pcall_result, const char *mod, const char *fxn); -void script_run_callbacks_f( - lua_State *L, int nargs, RunCallbacksMode mode, const char *fxn); +void script_run_callbacks_f(lua_State *L, int nargs, + RunCallbacksMode mode, const char *fxn); -void log_deprecated(lua_State *L, const std::string &message, int stack_depth = 1); +void log_deprecated(lua_State *L, const std::string &message, + int stack_depth=1); |