diff options
author | red-001 <red-001@outlook.ie> | 2018-01-04 07:21:12 +0000 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-01-04 08:21:12 +0100 |
commit | 30821ad8deb42728fbba9de60dda31033f70aaac (patch) | |
tree | 93e98b7699736fb98244b3bb586413bb1ed9d277 /src/script/cpp_api/s_base.h | |
parent | e7396a0c5060eccf3d4aea9b83647e1d02df308b (diff) | |
download | minetest-30821ad8deb42728fbba9de60dda31033f70aaac.tar.gz minetest-30821ad8deb42728fbba9de60dda31033f70aaac.tar.bz2 minetest-30821ad8deb42728fbba9de60dda31033f70aaac.zip |
[CSM] Don't load the IO library. (#6087)
* [CSM] Don't load the IO library.
* Rename the function to match the Lua API function name and add a missing `const`
* Add a comment to explain some strange code and fix the other issues pointed out by shadowninja.
Diffstat (limited to 'src/script/cpp_api/s_base.h')
-rw-r--r-- | src/script/cpp_api/s_base.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/script/cpp_api/s_base.h b/src/script/cpp_api/s_base.h index a170f82dc..18cb841cf 100644 --- a/src/script/cpp_api/s_base.h +++ b/src/script/cpp_api/s_base.h @@ -23,15 +23,19 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <string> #include <thread> #include <mutex> +#include <unordered_map> #include "util/basic_macros.h" extern "C" { #include <lua.h> +#include <lualib.h> } #include "irrlichttypes.h" #include "common/c_types.h" #include "common/c_internal.h" +#include "debug.h" +#include "cmake_config.h" #define SCRIPTAPI_LOCK_DEBUG #define SCRIPTAPI_DEBUG @@ -54,9 +58,10 @@ extern "C" { setOriginFromTableRaw(index, __FUNCTION__) enum class ScriptingType: u8 { + Async, Client, - Server, - MainMenu + MainMenu, + Server }; class Server; @@ -70,7 +75,12 @@ class ServerActiveObject; class ScriptApiBase { public: - ScriptApiBase(); + ScriptApiBase(ScriptingType type); + // fake constructor to allow script API classes (e.g ScriptApiEnv) to virtually inherit from this one. + ScriptApiBase() + { + FATAL_ERROR("ScriptApiBase created without ScriptingType!"); + } virtual ~ScriptApiBase(); DISABLE_CLASS_COPY(ScriptApiBase); @@ -91,7 +101,6 @@ public: IGameDef *getGameDef() { return m_gamedef; } Server* getServer(); - void setType(ScriptingType type) { m_type = type; } ScriptingType getType() { return m_type; } #ifndef SERVER Client* getClient(); @@ -101,6 +110,8 @@ public: void setOriginDirect(const char *origin); void setOriginFromTableRaw(int index, const char *fxn); + void clientOpenLibs(lua_State *L); + protected: friend class LuaABM; friend class LuaLBM; |