Graphite Version 3
An experimental 3D geometry processing program
Loading...
Searching...
No Matches
lua_graphite_object.h File Reference

Lua wrapper around a Graphite object. More...

Go to the source code of this file.

Classes

struct  OGF::GOMLua::GraphiteRef
 Representation of a pointer to a Graphite object in the LUA interpreter. More...
 

Namespaces

namespace  OGF
 Global Graphite namespace.
 

Functions

bool OGF::GOMLua::lua_isgraphite (lua_State *L, int index)
 Tests whether a LUA object is a graphite object.
 
ObjectOGF::GOMLua::lua_tographite (lua_State *L, int index)
 Gets a pointer to a graphite object from a LUA object.
 
void OGF::GOMLua::lua_pushgraphite (lua_State *L, Object *object, bool managed=true)
 Pushes a graphite object onto the LUA stack.
 
void OGF::GOMLua::init_lua_graphite (LuaInterpreter *interpreter)
 Initializes the LUA state for graphite.
 

Detailed Description

Lua wrapper around a Graphite object.

Definition in file lua_graphite_object.h.

Function Documentation

◆ init_lua_graphite()

void OGF::GOMLua::init_lua_graphite ( LuaInterpreter interpreter)

Initializes the LUA state for graphite.

Registers GOM implementation functions, creates the metatables for graphite objects and graphite requests, and create the global table for LUA targets. The global tables are created in the registry.

Parameters
[in]interpretera pointer to the LuaInterpreter.

◆ lua_isgraphite()

bool OGF::GOMLua::lua_isgraphite ( lua_State *  L,
int  index 
)

Tests whether a LUA object is a graphite object.

Parameters
[in]La pointer to the LUA state.
[in]indexthe stack index of the LUA object to be tested.
Return values
trueif the LUA object at index is a graphite object.
falseotherwise.

◆ lua_pushgraphite()

void OGF::GOMLua::lua_pushgraphite ( lua_State *  L,
Object object,
bool  managed = true 
)

Pushes a graphite object onto the LUA stack.

Graphite objects in LUA are seen as a full user data that contains a pointer to the object. We use full user data (rather than light user data) because full user data can have a metatable, that lets us redirect member access to the GOM system.

Parameters
[in]La pointer to the LUA state.
[in]objecta pointer to the graphite object
[in]managedif true, manages reference count, else only store a reference to the object without changing the reference count. This is needed for the Interpreter itself, accessible through the "gom" global variable. If it was reference-counted, then we would have a circular reference, preventing the interpreter from being deallocated on exit.

◆ lua_tographite()

Object * OGF::GOMLua::lua_tographite ( lua_State *  L,
int  index 
)

Gets a pointer to a graphite object from a LUA object.

Precondition
lua_isgraphite(L,index)
Parameters
[in]La pointer to the LUA state.
[in]indexthe stack index of the LUA object to be tested.
Returns
a pointer to the graphite object.