Feat lua file watch (#1584)
* feat lua: file watcher for lua script file: reload scripts if they got changed since they were initially loaded * feat lua auto reload: enable / disable the feature through the ui and settings
This commit is contained in:
@ -63,7 +63,9 @@ namespace big
|
||||
m_state.set_exception_handler((sol::exception_handler_function)exception_handler);
|
||||
m_state.set_panic(panic_handler);
|
||||
|
||||
auto result = m_state.load_file(scripts_folder.get_file(module_name).get_path().string());
|
||||
const auto script_file_path = scripts_folder.get_file(module_name).get_path();
|
||||
m_last_write_time = std::filesystem::last_write_time(script_file_path);
|
||||
auto result = m_state.load_file(script_file_path.string());
|
||||
|
||||
if (!result.valid())
|
||||
{
|
||||
@ -90,16 +92,21 @@ namespace big
|
||||
m_registered_patches.clear();
|
||||
}
|
||||
|
||||
rage::joaat_t lua_module::module_id()
|
||||
rage::joaat_t lua_module::module_id() const
|
||||
{
|
||||
return m_module_id;
|
||||
}
|
||||
|
||||
const std::string& lua_module::module_name()
|
||||
const std::string& lua_module::module_name() const
|
||||
{
|
||||
return m_module_name;
|
||||
}
|
||||
|
||||
const std::chrono::time_point<std::chrono::file_clock> lua_module::last_write_time() const
|
||||
{
|
||||
return m_last_write_time;
|
||||
}
|
||||
|
||||
void lua_module::add_folder_to_require_available_paths(const big::folder& scripts_folder)
|
||||
{
|
||||
const std::string package_path = m_state["package"]["path"];
|
||||
|
Reference in New Issue
Block a user