3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include "irrlichttypes.h"
31 #include "jthread/jmutex.h"
32 #include "jthread/jmutexautolock.h"
33 #include "common/c_types.h"
34 #include "common/c_internal.h"
36 #define SCRIPTAPI_LOCK_DEBUG
41 class ServerActiveObject;
47 virtual ~ScriptApiBase();
49 bool loadMod(const std::string &scriptpath, const std::string &modname);
50 bool loadScript(const std::string &scriptpath);
53 void addObjectReference(ServerActiveObject *cobj);
54 void removeObjectReference(ServerActiveObject *cobj);
59 friend class ObjectRef;
60 friend class NodeMetaRef;
61 friend class ModApiBase;
62 friend class ModApiEnvMod;
63 friend class LuaVoxelManip;
66 { return m_luastack; }
70 void stackDump(std::ostream &o);
72 Server* getServer() { return m_server; }
73 void setServer(Server* server) { m_server = server; }
75 Environment* getEnv() { return m_environment; }
76 void setEnv(Environment* env) { m_environment = env; }
78 GUIEngine* getGuiEngine() { return m_guiengine; }
79 void setGuiEngine(GUIEngine* guiengine) { m_guiengine = guiengine; }
81 void objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj);
82 void objectrefGet(lua_State *L, u16 id);
84 JMutex m_luastackmutex;
85 // Stack index of Lua error handler
87 #ifdef SCRIPTAPI_LOCK_DEBUG
92 lua_State* m_luastack;
95 Environment* m_environment;
96 GUIEngine* m_guiengine;
99 #endif /* S_BASE_H_ */