Binding existing objects
oschepkovdaniel opened this issue · 2 comments
oschepkovdaniel commented
Hi! The library is very useful, but what about binding existing C++ objects (instances of classes) to lua? Is there any solutions for this?
gengyong commented
define a "ctor" for it, return the object instance. the "ctor" accept one or two functor which for alloc and free the object, if you set deleter functor as null, the object will never be GC from lua, this behavior fit for most singleton patern.
oschepkovdaniel commented
Thanks for help =]
вт, 7 июн. 2022 г., 08:19 GENG Yong ***@***.***>:
… define a "ctor" for it, return the object instance. the "ctor" accept one
or two functor which for alloc and free the object, if you set deleter
functor as null, the object will never be GC from lua, this behavior fit
for most singleton patern.
—
Reply to this email directly, view it on GitHub
<#21 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXY4TK6O2KE6H7O4QMIMSQLVN2PQVANCNFSM5YADYDFA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>