Namespace Engine::LuaAPI::Internal¶
Namespace List > Engine > LuaAPI > Internal
Public Functions¶
| Type | Name |
|---|---|
| sol::object | GenericToLua (sol::state_view lua, const glz::generic & value) Converts a glaze value back into a Lua value. |
| glz::generic | LuaToGeneric (const sol::object & obj, std::set< const void * > & seen, int depth=0) Converts a Lua value into a JSON-serializable glaze value. |
| sol::table | ensureNamespace (sol::state_view lua, const char * name) Creates or fetches a global namespace table (e.g. "Component"). |
| void | ensureTransform (Registry & registry, Entity entity, bool withRotation) Adds a Position (and optionallyRotation ) component if the entity lacks it. |
Public Functions Documentation¶
function GenericToLua¶
Converts a glaze value back into a Lua value.
sol::object Engine::LuaAPI::Internal::GenericToLua (
sol::state_view lua,
const glz::generic & value
)
function LuaToGeneric¶
Converts a Lua value into a JSON-serializable glaze value.
glz::generic Engine::LuaAPI::Internal::LuaToGeneric (
const sol::object & obj,
std::set< const void * > & seen,
int depth=0
)
Functions, threads and userdata become null. Tables are converted to arrays when their keys are exactly 1..N, otherwise to objects with stringified keys.
Parameters:
seenCycle guard shared across a single conversion.depthCurrent nesting depth.
function ensureNamespace¶
Creates or fetches a global namespace table (e.g. "Component").
inline sol::table Engine::LuaAPI::Internal::ensureNamespace (
sol::state_view lua,
const char * name
)
Safe to call from many independent registration modules: the first caller creates the table, subsequent callers just add their own keys. This removes any ordering requirement between registration files.
Parameters:
luaView of the shared Lua state (passed by value; cheap to copy).nameGlobal name, e.g. "Transform" or "Component".
function ensureTransform¶
Adds a Position (and optionallyRotation ) component if the entity lacks it.
inline void Engine::LuaAPI::Internal::ensureTransform (
Registry & registry,
Entity entity,
bool withRotation
)
Most visual components are meaningless without a transform, so every binding that adds a visual component calls this first. Keeps the ordering rule implicit for script authors.
The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Scripting/LuaAPI/Internal/Helpers.hpp