dl
dl_lua.h
浏览该文件的文档.
1
15#pragma once
16
17#include <string>
18#include <unordered_map>
19
20#define SOL_ALL_SAFETIES_ON 1
21#define SOL_PRINT_ERRORS 0
22#include <sol/sol.hpp>
23
24#include "dl_io.h"
25
26struct lua_State;
27namespace dl
28{
31{
32public:
35
36 struct Env
37 {
38 //std::string _funcUpdate;
39 };
40
43 void SetPathRoot(std::string_view str) { _pathRoot = std::string{ str }; }
44
45
46 bool DoString(std::string_view str);
47 bool DoFile(std::string_view path_name);
48
49 bool ExcuteFunction(sol::function func);
50
51 Env& GetEnv() { return _env; }
52 sol::state& GetL() { return _l; }
53
54 // 由引擎调用
56private:
57 Env _env;
58 std::string _pathRoot;
59
60 sol::state _l;
61};
62
63extern LuaScript* g_lua;
64}
lua脚本语言
sol::state & GetL()
bool DoFile(std::string_view path_name)
void SetPathRoot(std::string_view str)
设置加载根路径
void RegisterAll()
bool DoString(std::string_view str)
bool ExcuteFunction(sol::function func)
io相关
LuaScript * g_lua