summaryrefslogtreecommitdiff
path: root/source/modules/asura-utils/scripting
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-30 11:59:35 +0800
committerchai <chaifix@163.com>2019-03-30 11:59:35 +0800
commitc270d033fa04873ee7a8925dbb00cae5edc4555c (patch)
treeee27a45c5b946b08dd7a726a925028f6ca3eabf1 /source/modules/asura-utils/scripting
parent771df5c31cd5653467fd6e76c1a3e002ca39582c (diff)
*misc
Diffstat (limited to 'source/modules/asura-utils/scripting')
-rw-r--r--source/modules/asura-utils/scripting/lua_env.h72
-rw-r--r--source/modules/asura-utils/scripting/portable.hpp8
2 files changed, 6 insertions, 74 deletions
diff --git a/source/modules/asura-utils/scripting/lua_env.h b/source/modules/asura-utils/scripting/lua_env.h
deleted file mode 100644
index e2fc4fc..0000000
--- a/source/modules/asura-utils/scripting/lua_env.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef __ASURA_LUA_ENV_H__
-#define __ASURA_LUA_ENV_H__
-
-extern "C"
-{
-#include <Lua51/lua.h>
-#include <Lua51/lauxlib.h>
-}
-#include <Luax/luax.h>
-
-#include "../singleton.hpp"
-
-namespace AsuraEngine
-{
- namespace Scripting
- {
-
- ///
- /// ͨӿڷlua stateAsura˼ǣ߳άһluaӦ
- /// Ҫ߼ڴlua߳߽ջ
- ///
- class LuaEnv ASURA_FINAL : public Singleton<LuaEnv>
- {
- public:
-
- LuaEnv() : mVM(0) {};
- ~LuaEnv() {};
-
- ///
- /// ִջ
- ///
- inline void Init()
- {
- ASSERT(!mVM);
- mVM = new Luax::LuaxVM();
- ASSERT(mVM);
- mVM->Setup();
- };
-
- inline lua_State* GetMainThread()
- {
- return mVM->GetMainThread();
- };
-
- inline void Exit()
- {
- delete mVM;
- mVM = nullptr;
- }
-
- private:
-
- ///
- /// ̱߳һluaһAsuraԶֻһ󲿷ִ붼
- /// УֻһΡ߳\ִջӦglobal_Stateģ
- ///
- /// struct lua_State *mainthread;
- ///
- /// ʹlua_newstate()ᴴһһglobal_Stateṹһ
- /// ߳lua_Stateءglobal_State̹߳˵һ
- /// ߳lua_newstate()⣬߳lua_newthread()
- ///
- Luax::LuaxVM* mVM;
-
- };
-
- }
-}
-
-namespace AEScripting = AsuraEngine::Scripting;
-
-#endif \ No newline at end of file
diff --git a/source/modules/asura-utils/scripting/portable.hpp b/source/modules/asura-utils/scripting/portable.hpp
index 5badf8d..ffed49e 100644
--- a/source/modules/asura-utils/scripting/portable.hpp
+++ b/source/modules/asura-utils/scripting/portable.hpp
@@ -1,10 +1,14 @@
#ifndef __ASURA_ENGINE_PORTABLE_H__
#define __ASURA_ENGINE_PORTABLE_H__
+extern "C" {
+#include <lua51/lua.h>
+#include <lua51/lualib.h>
+#include <lua51/lauxlib.h>
+}
+#include <luax/luax.h>
#include "../type.h"
-#include "lua_env.h"
-
namespace AsuraEngine
{
namespace Scripting