diff options
Diffstat (limited to 'src/script/cpp_api/s_base.h')
-rw-r--r-- | src/script/cpp_api/s_base.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/script/cpp_api/s_base.h b/src/script/cpp_api/s_base.h index 4ea3677a9..cf9b7b934 100644 --- a/src/script/cpp_api/s_base.h +++ b/src/script/cpp_api/s_base.h @@ -35,6 +35,12 @@ extern "C" { #define SCRIPTAPI_LOCK_DEBUG +#define SCRIPT_MOD_NAME_FIELD "current_mod_name" +// MUST be an invalid mod name so that mods can't +// use that name to bypass security! +#define BUILTIN_MOD_NAME "*builtin*" + + class Server; class Environment; class GUIEngine; @@ -42,17 +48,18 @@ class ServerActiveObject; class ScriptApiBase { public: - ScriptApiBase(); virtual ~ScriptApiBase(); - bool loadMod(const std::string &scriptpath, const std::string &modname); - bool loadScript(const std::string &scriptpath); + bool loadMod(const std::string &script_path, const std::string &mod_name); + bool loadScript(const std::string &script_path); /* object */ void addObjectReference(ServerActiveObject *cobj); void removeObjectReference(ServerActiveObject *cobj); + Server* getServer() { return m_server; } + protected: friend class LuaABM; friend class InvRef; @@ -69,7 +76,6 @@ protected: void scriptError(); void stackDump(std::ostream &o); - Server* getServer() { return m_server; } void setServer(Server* server) { m_server = server; } Environment* getEnv() { return m_environment; } @@ -84,6 +90,7 @@ protected: JMutex m_luastackmutex; // Stack index of Lua error handler int m_errorhandler; + bool m_secure; #ifdef SCRIPTAPI_LOCK_DEBUG bool m_locked; #endif |