8#include <nlohmann/json.hpp>
10#include "galaxy/core/ServiceLocator.hpp"
32 this->
m_file = std::move(s.m_file);
33 this->
m_self = std::move(s.m_self);
34 this->
m_update = std::move(s.m_update);
44 this->
m_file = std::move(s.m_file);
45 this->
m_self = std::move(s.m_self);
46 this->
m_update = std::move(s.m_update);
63 sol::function destruct =
m_self[
"destruct"];
74 if (!core::ServiceLocator<fs::VirtualFileSystem>::ref().exists(
m_file))
88 nlohmann::json json =
"{}"_json;
99 load(json.at(
"file"));
101 if (json.contains(
"show_functions"))
106 if (json.contains(
"show_userdata"))
111 if (json.contains(
"show_unknown"))
#define GALAXY_LOG(level, msg,...)
High level abstraction of a lua script.
virtual ~Script()
Destructor.
bool m_show_userdata
For editor. Shows userdata types.
bool m_show_unknown
For editor. Show unknown type data.
const std::string & file() const
Get script file path.
Script & operator=(Script &&)
Move assignment operator.
void deserialize(const nlohmann::json &json) override
Deserializes from object.
void load(std::string_view file)
Load a script.
bool m_show_functions
For editor. Show functions.
nlohmann::json serialize() override
Serializes object.
sol::table m_self
The script object (table) returned by a lua script.
std::string m_file
Script file.
sol::function m_update
The update function belonging to the lua table.