From 922495098aea1ca569369da664dddb9780d07768 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 19 Oct 2021 19:52:29 +0800 Subject: *misc --- Runtime/FileSystem/Path.cpp | 0 Runtime/FileSystem/Path.h | 0 Runtime/Lua/LuaBind/LuaBindState.cpp | 3 ++- Runtime/Scripting/Debug/Debug.bind.cpp | 2 ++ Runtime/Scripting/FileSystem/FileSystem.bind.cpp | 10 ++++++++ Runtime/Scripting/Path.bind.cpp | 32 ++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Runtime/FileSystem/Path.cpp create mode 100644 Runtime/FileSystem/Path.h create mode 100644 Runtime/Scripting/FileSystem/FileSystem.bind.cpp create mode 100644 Runtime/Scripting/Path.bind.cpp (limited to 'Runtime') diff --git a/Runtime/FileSystem/Path.cpp b/Runtime/FileSystem/Path.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Runtime/FileSystem/Path.h b/Runtime/FileSystem/Path.h new file mode 100644 index 0000000..e69de29 diff --git a/Runtime/Lua/LuaBind/LuaBindState.cpp b/Runtime/Lua/LuaBind/LuaBindState.cpp index 8b6a5aa..fa2952f 100644 --- a/Runtime/Lua/LuaBind/LuaBindState.cpp +++ b/Runtime/Lua/LuaBind/LuaBindState.cpp @@ -164,7 +164,8 @@ namespace LuaBind } if (lua_pcall(mState, nArgs, nResults, func) == 0) { - lua_remove(mState, func); + if(func != 0) + lua_remove(mState, func); } else { diff --git a/Runtime/Scripting/Debug/Debug.bind.cpp b/Runtime/Scripting/Debug/Debug.bind.cpp index 6d37746..9d98211 100644 --- a/Runtime/Scripting/Debug/Debug.bind.cpp +++ b/Runtime/Scripting/Debug/Debug.bind.cpp @@ -88,6 +88,8 @@ int logEditor(lua_State* L) log_error("Debug.Log()错误的参数个数"); } return 0; +#else + return 0; #endif } diff --git a/Runtime/Scripting/FileSystem/FileSystem.bind.cpp b/Runtime/Scripting/FileSystem/FileSystem.bind.cpp new file mode 100644 index 0000000..fea8b57 --- /dev/null +++ b/Runtime/Scripting/FileSystem/FileSystem.bind.cpp @@ -0,0 +1,10 @@ +#include + +#include "Runtime/Lua/LuaBind/LuaBind.h" + +int luaopen_GameLab_FileSystem(lua_State* L) +{ + + return 1; +} + diff --git a/Runtime/Scripting/Path.bind.cpp b/Runtime/Scripting/Path.bind.cpp new file mode 100644 index 0000000..920f586 --- /dev/null +++ b/Runtime/Scripting/Path.bind.cpp @@ -0,0 +1,32 @@ +#include "Runtime/Lua/LuaBind/LuaBind.h" + +#ifdef GAMELAB_WIN +#include +#endif + +using namespace LuaBind; + +static int GetRootDirectory(lua_State* L) +{ +#ifdef GAMELAB_WIN + char path[MAX_PATH]; + GetCurrentDirectory(MAX_PATH, path); + lua_pushstring(L, path); + return 1; +#else + return 0; +#endif +} + +int luaopen_GameLab_Path(lua_State* L) +{ + LUA_BIND_STATE(L); + + state.PushGlobalNamespace(); + state.PushNamespace("GameLab"); + state.PushNamespace("Path"); + + state.RegisterMethod("GetRootDirectory", GetRootDirectory); + + return 1; +} -- cgit v1.1-26-g67d0