Re: References to native types

Michael Steinberg <[email protected]> Sun, 29 Sep 2013 16:55:15 +0200
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
Hello again,
digging through the list I found this issue to pop up again and again.
People were trying to use refs to native types, or there were
complaining why luabind wouldn't support it etc.. Maybe it would be wise
to add a paragraph to the documentation stating that is just not
possible to implement that, since lua does not know about
references/pointers?
The only thing that I can imagine one could do would be to provide an
opt-in type boxing support. So you could inject boxed native types into
lua that could be unboxed into references on the c++ side again (I think
this is quite similar to what Java has?). And some way to box native
types on the lua side to, to simulate references. One would then have to
differ between lua and c++ boxes, because c++ boxes would contain
pointers to a c++ value, whereas boxes created in lua would have a true
datamember...
The unboxing converter would then have to differ between c++ boxes and
lua boxes, because the latter would have to write back to the table,
whereas the former supplied the true pointer and wouldn't have to do
anything.
But any way, we'd have to manually box and unbox the types in native and
in lua code. So I really doubt that it's worth the great effort that is
necessary to implement that.

Michael

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk