summaryrefslogtreecommitdiff
path: root/libs/lua/LuaBridge/LuaBridge.h
AgeCommit message (Collapse)Author
2016-07-18rework lua-bridge C++ variable referencesRobin Gareus
Since lua functions are closures, C++ methods that pass arguments by reference cannot be used directly. The previous approach (boost::ref) failed with clang. Assume the following: void foo (float&) { } static inline float& bar () { boost::reference_wrapper<float> r (42); return r.get (); } foo ( bar () ); With gcc, "r" goes out of scope after foo's arguments are processed and all is well. But with clang, "r" already leave scope when *inlined* bar() returns. Solution: allocate some user-data on the lua-stack to hold the reference. There is no reference to this user-data so lua will eventually garbage collect it. (theoretically, creating the table which holds the return-values could trigger an emergency garbage collection when memory is low and free the reference just while they're being pushed to the table, then gain FuncArgs<Params> already dereferenced them all as variable on the C stack -- probably again compiler specific)
2016-03-23refactor lua header includesRobin Gareus
2016-03-20Prepare Lua Binding Documentation (JSON)Robin Gareus
2016-02-22LuaBridge: support argument references via table returnRobin Gareus
2016-02-22customize LuaBridgeRobin Gareus
* introduce boost::shared_ptr support * support enum & const * allow to add non-class member functions * STL iterators (vector, list, set, bitset & map) * support reference arguments (framecnt_t&) * add support for arrays of basic types (e.g. float*, int*) * fix compiler warnings
2016-02-22add LuaBridgeRobin Gareus
https://github.com/vinniefalco/LuaBridge