lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 29/06/2011 8.41, Sean Conner wrote:
It was thus said that the Great Lorenzo Donati once stated:

Sorry for expressing my thought so badly, but mine was a sort of
half-baked "philosophical" rambling on Lua design about userdata :-)

So any enlightment is welcome (I only played shortly with C API and
although I know C, I cannot really call myself a C programmer, thus it
may well be that I missed completely the point of userdata and why their
usefulness is limited to C side!)

   It's used to add support for other data types.  I have code that
implements network addresses as a "userdata" for Lua [1].  I can do things
like:


[...]



   -spc (Think of it as a way of mapping a C structure into Lua)


[...]

Thanks for the explanation!

So why it is not deemed useful to have the possibility to define custom data types in this way directly in Lua (not using C API, I mean)?

-- Lorenzo