diff --git a/libs/lua/LuaBridge/detail/Namespace.h b/libs/lua/LuaBridge/detail/Namespace.h index 46fdaa5252..fdb9e82012 100644 --- a/libs/lua/LuaBridge/detail/Namespace.h +++ b/libs/lua/LuaBridge/detail/Namespace.h @@ -1304,6 +1304,22 @@ private: return addConstructor (); } + template + WSPtrClass & 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 ::f, 1); + rawsetfield (L, -2, name); + + set_weak_class (); + new (lua_newuserdata (L, sizeof (fp))) FP (fp); + lua_pushcclosure (L, &CFunc::Call ::f, 1); + rawsetfield (L, -2, name); + return *this; + } + WSPtrClass & addNilPtrConstructor () { FUNDOC ("Weak/Shared Pointer NIL Constructor", "", void (*) ())