11#include <unordered_map>
26#define SCRIPTAPI_LOCK_DEBUG
30#define BUILTIN_MOD_NAME "*builtin*"
32#define PCALL_RES(RES) { \
33 int result_ = (RES); \
35 scriptError(result_, __FUNCTION__); \
39#define runCallbacks(nargs, mode) \
40 runCallbacksRaw((nargs), (mode), __FUNCTION__)
42#define setOriginFromTable(index) \
43 setOriginFromTableRaw(index, __FUNCTION__)
54#if CHECK_CLIENT_BUILD()
70 FATAL_ERROR(
"ScriptApiBase created without ScriptingType!");
76 void loadMod(
const std::string &script_path,
const std::string &mod_name);
77 void loadScript(
const std::string &script_path);
79#if CHECK_CLIENT_BUILD()
80 void loadModFromMemory(
const std::string &mod_name);
94#if CHECK_CLIENT_BUILD()
114#if !CHECK_CLIENT_BUILD()
158#if CHECK_CLIENT_BUILD()
159 GUIEngine* getGuiEngine() {
return m_guiengine; }
160 void setGuiEngine(
GUIEngine* guiengine) { m_guiengine = guiengine; }
173#ifdef SCRIPTAPI_LOCK_DEBUG
185#if CHECK_CLIENT_BUILD()
RunCallbacksMode
Definition c_internal.h:84
Definition emerge_internal.h:25
Definition environment.h:34
implementation of main menu based uppon formspecs
Definition guiEngine.h:113
Definition l_inventory.h:18
static std::string getCurrentModNameInsecure(lua_State *L)
Returns the currently running mod, only during init time.
Definition s_base.cpp:220
void setOriginDirect(const char *origin)
Definition s_base.cpp:389
void addObjectReference(ServerActiveObject *cobj)
Definition s_base.cpp:415
std::recursive_mutex m_luastackmutex
Definition s_base.h:170
void setEnv(Environment *env)
Definition s_base.h:156
void stackDump(std::ostream &o)
Definition s_base.cpp:362
void pushPlayerHPChangeReason(lua_State *L, const PlayerHPChangeReason &reason)
Definition s_base.cpp:481
Environment * getEnv()
Definition s_base.h:155
IGameDef * getGameDef()
Definition s_base.h:92
EmergeThread * m_emerge
Definition s_base.h:188
IGameDef * m_gamedef
Definition s_base.h:183
void realityCheck()
Definition s_base.cpp:346
ScriptingType getType()
Definition s_base.h:90
DISABLE_CLASS_COPY(ScriptApiBase)
EmergeThread * getEmergeThread()
Definition s_base.h:163
int m_lock_recursion_count
Definition s_base.h:174
void clientOpenLibs(lua_State *L)
Definition s_base.h:115
void setEmergeThread(EmergeThread *emerge)
Definition s_base.h:164
ScriptApiBase()
Definition s_base.h:68
ScriptingType m_type
Definition s_base.h:190
std::string m_last_run_mod
Definition s_base.h:171
void loadScript(const std::string &script_path)
Definition s_base.cpp:236
void loadMod(const std::string &script_path, const std::string &mod_name)
Definition s_base.cpp:228
void removeObjectReference(ServerActiveObject *cobj)
Definition s_base.cpp:436
Server * getServer()
Definition s_base.cpp:513
lua_State * m_luastack
Definition s_base.h:181
void setGameDef(IGameDef *gamedef)
Definition s_base.h:153
static int luaPanic(lua_State *L)
Definition s_base.cpp:163
const std::string & getOrigin()
Definition s_base.h:100
lua_State * getStack()
Definition s_base.h:143
void runCallbacksRaw(int nargs, RunCallbacksMode mode, const char *fxn)
Definition s_base.cpp:305
void checkSetByBuiltin()
Definition s_base.cpp:202
virtual ~ScriptApiBase()
Definition s_base.cpp:158
std::thread::id m_owning_thread
Definition s_base.h:175
void scriptError(int result, const char *fxn)
Definition s_base.cpp:357
void setOriginFromTableRaw(int index, const char *fxn)
Definition s_base.cpp:394
Environment * m_environment
Definition s_base.h:184
void objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj)
Definition s_base.cpp:460
Definition serveractiveobject.h:41
Definition test_moveaction.cpp:12
#define FATAL_ERROR(msg)
Definition debug.h:33
ScriptingType
Definition s_base.h:45
Definition player_sao.h:227