mxnet
|
an reference to lua object More...
#include <lua.h>
Public Member Functions | |
LuaRef ()=default | |
construct an nil ref More... | |
LuaRef (LuaRef &&other) | |
move constructor from another LuaRef More... | |
LuaRef (const LuaRef &other) | |
copy constructor More... | |
LuaRef & | operator= (LuaRef &&other) |
assign operator from other More... | |
LuaRef & | operator= (const LuaRef &other) |
assign operator from other More... | |
~LuaRef () | |
destructor More... | |
void | swap (LuaRef &other) |
swap content with another ref More... | |
template<typename T > | |
T | Get () const |
Get content out as type T. More... | |
template<typename T > | |
T * | GetUDataPtr () const |
Get user data pointer from LuaRef. More... | |
bool | is_nil () const |
template<typename... Args> | |
LuaRef | operator() (Args &&...args) const |
invoke the LuaRef as function More... | |
LuaRef | operator[] (const std::string &key) const |
Get field from the lua table. The reference must be a table. More... | |
LuaRef | operator[] (size_t index) const |
Get field from the lua array The reference must be a array. More... | |
template<typename T > | |
LuaRef & | SetField (const std::string &key, const T &value) |
Set field of lua table. The reference must be a table. More... | |
void | SetByPopStack_ (LuaState *s) |
Set LuaRef to the value on top of the stack. This state must be nil. This is API used by developer. More... | |
Friends | |
struct | lua_stack::Handler< LuaRef > |
class | LuaState |
std::ostream & | operator<< (std::ostream &os, const LuaRef &r) |
an reference to lua object
|
default |
construct an nil ref
|
inline |
|
inline |
copy constructor
other | The other LuaRef to be copied |
|
inline |
destructor
|
inline |
Get content out as type T.
T | the type to be fetched. |
|
inline |
Get user data pointer from LuaRef.
CAREFUL when getting userdata(e.g. pointer to Tensor's storage) from LuaRef. Remember they are managed by Lua, and can get deleted when all the LuaRef to the userdata destructs. A good practice is always use a LuaRef to keep the userdata alive when you need them from C++ side.
T | the type of pointer to be fetched. |
|
inline |
|
inline |
invoke the LuaRef as function
args | Arguments to be passed. |
Args | arguments to be passed. |
|
inline |
Get field from the lua table. The reference must be a table.
key | The key to the table |
|
inline |
Get field from the lua array The reference must be a array.
index | The index to the array, Note: the index convention follows lua table, starts from 1 |
|
inline |
Set LuaRef to the value on top of the stack. This state must be nil. This is API used by developer.
s | the corresponding lua state. |
|
inline |
Set field of lua table. The reference must be a table.
key | The key to the table |
value | Lua convertable value to be setted. |
|
inline |
swap content with another ref
other | another LuaRef to be swaped. |
|
friend |
|
friend |
|
friend |