mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-06 10:16:25 +00:00
48 lines
No EOL
1.5 KiB
C
48 lines
No EOL
1.5 KiB
C
#ifndef SMLUA_H
|
|
#define SMLUA_H
|
|
|
|
#include <lua.h>
|
|
#include <lualib.h>
|
|
#include <lauxlib.h>
|
|
|
|
#include <stdbool.h>
|
|
#include "types.h"
|
|
|
|
#include "smlua_cobject.h"
|
|
#include "smlua_cobject_allowlist.h"
|
|
#include "smlua_cobject_autogen.h"
|
|
#include "smlua_utils.h"
|
|
#include "smlua_functions.h"
|
|
#include "smlua_functions_autogen.h"
|
|
#include "smlua_hooks.h"
|
|
#include "smlua_sync_table.h"
|
|
|
|
#include "pc/debuglog.h"
|
|
|
|
#define LOG_LUA(...) { if (!gSmLuaSuppressErrors) { _debuglog_print_log("LUA ", __FILE__), printf(__VA_ARGS__), printf("\n"), smlua_mod_error(); } }
|
|
#define LOG_LUA_LINE(...) { if (!gSmLuaSuppressErrors) { _debuglog_print_log("LUA ", __FILE__), printf(__VA_ARGS__), printf("\n"), smlua_mod_error(); smlua_logline(); } }
|
|
|
|
#ifdef DEVELOPMENT
|
|
#define LUA_STACK_CHECK_BEGIN() int __LUA_STACK_TOP = lua_gettop(gLuaState)
|
|
#define LUA_STACK_CHECK_END() if ((__LUA_STACK_TOP) != lua_gettop(gLuaState)) { smlua_dump_stack(); fflush(stdout); } assert((__LUA_STACK_TOP) == lua_gettop(gLuaState))
|
|
#else
|
|
#define LUA_STACK_CHECK_BEGIN()
|
|
#define LUA_STACK_CHECK_END()
|
|
#endif
|
|
|
|
extern lua_State* gLuaState;
|
|
extern u8 gLuaInitializingScript;
|
|
extern u8 gSmLuaSuppressErrors;
|
|
extern struct Mod* gLuaLoadingMod;
|
|
extern struct Mod* gLuaActiveMod;
|
|
extern struct Mod* gLuaLastHookMod;
|
|
|
|
void smlua_mod_error(void);
|
|
int smlua_error_handler(UNUSED lua_State* L);
|
|
int smlua_pcall(lua_State* L, int nargs, int nresults, int errfunc);
|
|
|
|
void smlua_init(void);
|
|
void smlua_update(void);
|
|
void smlua_shutdown(void);
|
|
|
|
#endif |