Binding existing objects #25
Answered
by
gengyong
oschepkovdaniel
asked this question in
Q&A
-
Hi! The library is very useful, but what about binding existing C++ objects (instances of classes) to lua? Is there any solutions for this? |
Beta Was this translation helpful? Give feedback.
Answered by
gengyong
Jun 7, 2022
Replies: 2 comments 1 reply
-
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. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
gengyong
-
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:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.