2023-04-15 21:23:12 +00:00
|
|
|
#pragma once
|
|
|
|
#include <lua.hpp>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2023-05-08 23:16:27 +00:00
|
|
|
#include <functional>
|
2023-04-15 21:23:12 +00:00
|
|
|
|
|
|
|
class LuaLoader {
|
|
|
|
public:
|
|
|
|
LuaLoader();
|
|
|
|
|
|
|
|
~LuaLoader();
|
|
|
|
|
|
|
|
void AddLuaPath(const std::string&);
|
|
|
|
void AddCPath(const std::string&);
|
|
|
|
void Call(const std::string& lua_module, const std::string& function);
|
|
|
|
void LoadToGlobal(const std::string&);
|
|
|
|
|
|
|
|
std::vector<std::string> GetListScripts(const std::string&) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Import(const std::string&, const std::string&, int);
|
|
|
|
void LoadImpl(const std::string&);
|
|
|
|
|
|
|
|
void ForEachByStringArray(std::function<void(const std::string&)>);
|
|
|
|
void ParseRequire();
|
|
|
|
void ParseImport();
|
|
|
|
|
|
|
|
lua_State* L;
|
|
|
|
};
|