Extend Lua binding for static methods
This add support for Lua bindings for static member functions in weak/share ptr class bindings.
This commit is contained in:
parent
ee43db8b54
commit
fbacb13d2d
@ -1304,6 +1304,22 @@ private:
|
||||
return addConstructor <void (*) ()> ();
|
||||
}
|
||||
|
||||
template <class FP>
|
||||
WSPtrClass <T>& addStaticFunction (char const* name, FP const fp)
|
||||
{
|
||||
FUNDOC ("Static Member Function", name, FP)
|
||||
set_shared_class ();
|
||||
new (lua_newuserdata (L, sizeof (fp))) FP (fp);
|
||||
lua_pushcclosure (L, &CFunc::Call <FP>::f, 1);
|
||||
rawsetfield (L, -2, name);
|
||||
|
||||
set_weak_class ();
|
||||
new (lua_newuserdata (L, sizeof (fp))) FP (fp);
|
||||
lua_pushcclosure (L, &CFunc::Call <FP>::f, 1);
|
||||
rawsetfield (L, -2, name);
|
||||
return *this;
|
||||
}
|
||||
|
||||
WSPtrClass <T>& addNilPtrConstructor ()
|
||||
{
|
||||
FUNDOC ("Weak/Shared Pointer NIL Constructor", "", void (*) ())
|
||||
|
Loading…
Reference in New Issue
Block a user