galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
LuaState.cpp
Go to the documentation of this file.
1
7
8#include <entt/locator/locator.hpp>
9#include <sol/sol.hpp>
10
12
13#include "../Lua.hpp"
14
15namespace galaxy
16{
17 void Lua::inject_state() noexcept
18 {
19 auto& lua = entt::locator<sol::state>::value();
20
21 auto state_type = lua.new_usertype<State>("State", sol::no_constructor);
22 state_type["on_pop"] = &State::on_pop;
23 state_type["on_push"] = &State::on_push;
24 state_type["name"] = &State::name;
25 }
26} // namespace galaxy
static void inject_state() noexcept
Injects galaxy state machine requirements into lua.
Definition LuaState.cpp:17
A state to use in a finite state machine.
Definition State.hpp:19
virtual void on_push()=0
Triggered when state is pushed onto the stack.
virtual void on_pop()=0
Triggered when state is popped off the stack.
const std::string & name() const noexcept
Get state name.
Definition State.cpp:17
Animated.cpp galaxy.
Definition Animated.cpp:16