Toast Engine
Loading...
Searching...
No Matches
lua_event.hpp File Reference

Lua event registration and binding for Toast events. More...

#include <concepts>
#include <functional>
#include <glm/fwd.hpp>
#include <lua.hpp>
#include <luabridge3/LuaBridge/LuaBridge.h>
#include <memory>
#include <string>
#include <string_view>
#include <toast/assets/core_types.hpp>
#include <toast/events/listener.hpp>
#include <toast/export.hpp>
#include <toast/uid.hpp>
#include <toast/world/box.hpp>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for lua_event.hpp:

Go to the source code of this file.

Classes

struct  scripting::LuaEventDescriptor
struct  scripting::LuaEventBinding
class  scripting::LuaEventRegistry
struct  scripting::LuaEventField< Owner, Get, Set >
class  scripting::ListenerProxy

Functions

template<typename Owner, typename Get, typename Set>
constexpr auto scripting::luaEventField (std::string_view name, std::string_view type, Get get, Set set) -> LuaEventField< Owner, Get, Set >
template<typename Owner, typename Member>
constexpr auto scripting::luaEventField (std::string_view name, Member Owner::*member)
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, bool &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, int64_t &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, double &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, std::string &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, toast::UID &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, toast::Box< toast::Node > &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, toast::Node *&out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, glm::vec2 &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, glm::vec3 &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, glm::vec4 &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, glm::ivec2 &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, glm::ivec3 &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, glm::ivec4 &out) -> bool
auto scripting::_detail::readEventPrimitive (lua_State *state, int index, glm::quat &out) -> bool
auto scripting::_detail::readEventHandle (lua_State *state, int index, std::string_view type, assets::HandleBase &out) -> bool
void scripting::_detail::pushEventPrimitive (lua_State *state, bool value)
void scripting::_detail::pushEventPrimitive (lua_State *state, int64_t value)
void scripting::_detail::pushEventPrimitive (lua_State *state, double value)
void scripting::_detail::pushEventPrimitive (lua_State *state, std::string_view value)
void scripting::_detail::pushEventPrimitive (lua_State *state, toast::UID value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const toast::Box< toast::Node > &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const toast::Node *value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const glm::vec2 &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const glm::vec3 &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const glm::vec4 &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const glm::ivec2 &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const glm::ivec3 &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const glm::ivec4 &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const glm::quat &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const assets::HandleBase &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const input::Action &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const physics::BroadPhasePair &value)
void scripting::_detail::pushEventPrimitive (lua_State *state, const event::ContactEventData &value)
void scripting::_detail::pushEventTable (lua_State *state, int field_count)
void scripting::_detail::setEventTableField (lua_State *state, std::string_view field)
auto scripting::_detail::pushEventField (lua_State *state, int table, std::string_view field) -> int
auto scripting::_detail::pushEventElement (lua_State *state, int table, int64_t i) -> int
void scripting::_detail::popEventValue (lua_State *state)
auto scripting::_detail::eventArrayLength (lua_State *state, int index) -> int64_t
void scripting::_detail::pushEventArray (lua_State *state, size_t size)
void scripting::_detail::setEventArrayElement (lua_State *state, int64_t i)
template<typename T>
auto scripting::_detail::readEventIndex (lua_State *state, int index, std::string_view type, T &out) -> bool
template<typename T>
auto scripting::_detail::readEventValue (lua_State *state, int table, std::string_view field, std::string_view type, T &out, std::string &error) -> bool
template<typename T>
void scripting::_detail::pushEventValue (lua_State *state, const T &value)
template<typename Event, typename... Fields, size_t... I>
auto scripting::_detail::sendEvent (lua_State *state, int payload, std::string &error, const std::tuple< Fields... > &fields, std::index_sequence< I... >) -> bool
template<typename Event, typename... Fields, size_t... I>
void scripting::_detail::pushEvent (lua_State *state, const Event &value, const std::tuple< Fields... > &fields, std::index_sequence< I... >)
template<typename Event, bool Sendable = true, typename... Fields>
void scripting::registerLuaEvent (std::string_view name, Fields... fields)
void scripting::clearLuaEventSubscriptions (void *runtime) noexcept
void scripting::clearAllLuaEventSubscriptions () noexcept

Variables

template<typename T>
constexpr bool scripting::_detail::is_vector_v = false
template<typename T, typename Alloc>
constexpr bool scripting::_detail::is_vector_v< std::vector< T, Alloc > > = true
template<typename T>
constexpr bool scripting::_detail::is_handle_v = false
template<typename T>
constexpr bool scripting::_detail::is_handle_v< assets::Handle< T > > = true

Detailed Description

Lua event registration and binding for Toast events.

Author
Xein
Date
25 Sep 2026

Function Documentation

◆ registerLuaEvent()

template<typename Event, bool Sendable = true, typename... Fields>
void scripting::registerLuaEvent ( std::string_view name,
Fields... fields )

Exposes Event to Lua as Events.<name>

Template Parameters
Sendablefalse for events lua cannot send (receive only)