Skip to content

Latest commit

 

History

History
34 lines (33 loc) · 1.3 KB

LUAGLUE.md

File metadata and controls

34 lines (33 loc) · 1.3 KB

Lua Glue

class LuaInterface<T> inheriting from it hooks regular c++ class T into Lua
    static ::Lua_Methods a map generated by LUA_METHOD macro to hook methods into Lua, will pull object and args from lua stack
    static ::Lua_Name a string to identify the class (as lua metamap)
    static ::Lua_Register(lua_state) registers the class with a lua_state
    ::Lua_Index("key") called when lua reads from "unknown" key in object
    ::Lua_NewIndex("key",variant) called when lua writes to "unknown" key in object
interface LuaType
    ::Lua_Push(L) pushes the object onto lua stack
class LuaVariant helper to pull any literal from / push any literal to lua stack
    ::Lua_Get(L) pulls value from stack
struct LuaRef helper to distinguish between integers and references
    int ::ref the actual reference
    bool ::valid() true if ref is set
class LuaEnum<T> helper to define a table that maps names -> values of type T
    ::Lua_Push(L) pushes the table to the lua stack
    ::Lua_SetGlobal(L, name) assigns the table to a global variable
class Lua provides a wrapper around lua state, for now we mix it with regular lua_* calls
    ::Lua(L) create wrapper for existing lua state L
    ::Push(...) push value onto lua stack, based on type
    ::PushNil() push nil onto lua stack