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"
32 #include "jmutexautolock.h"
33 #include "common/c_types.h"
35 #define SCRIPTAPI_LOCK_DEBUG
40 class ServerActiveObject;
46 virtual ~ScriptApiBase();
48 bool loadMod(const std::string &scriptpath, const std::string &modname);
49 bool loadScript(const std::string &scriptpath);
52 void addObjectReference(ServerActiveObject *cobj);
53 void removeObjectReference(ServerActiveObject *cobj);
58 friend class ObjectRef;
59 friend class NodeMetaRef;
60 friend class ModApiBase;
61 friend class ModApiEnvMod;
62 friend class LuaVoxelManip;
65 { return m_luastack; }
68 void scriptError(const char *fmt, ...);
69 void stackDump(std::ostream &o);
71 Server* getServer() { return m_server; }
72 void setServer(Server* server) { m_server = server; }
74 Environment* getEnv() { return m_environment; }
75 void setEnv(Environment* env) { m_environment = env; }
77 GUIEngine* getGuiEngine() { return m_guiengine; }
78 void setGuiEngine(GUIEngine* guiengine) { m_guiengine = guiengine; }
80 void objectrefGetOrCreate(ServerActiveObject *cobj);
81 void objectrefGet(u16 id);
83 JMutex m_luastackmutex;
84 #ifdef SCRIPTAPI_LOCK_DEBUG
88 lua_State* m_luastack;
91 Environment* m_environment;
92 GUIEngine* m_guiengine;
95 #endif /* S_BASE_H_ */