lua-users home
lua-l archive

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


Am 20.04.2014 01:41 schröbte Coroutines:
On Sat, Apr 19, 2014 at 4:20 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
Am 19.04.2014 23:56 schröbte Sean Conner:

It was thus said that the Great Coroutines once stated:


There would definitely be limitations -- I imagined this for
transferring data between lua states on the same platform, though.


    I hope you mean "same process" otherwise, you'll have problems with
pointers in the userdata.


You would have problems with pointers in the userdata anyway (e.g. when all
references to the userdata in state 1 are gone, the userdata is collected,
the pointer freed, and state 2 starts using a dangling pointer) ...

You can't dereference a lightuserdata from Lua, I don't see the issue
here...

I don't see the issue for lightuserdata either, you can just `print` it. So I was talking about full userdata and "transferring data between lua states".

most things in the debug library assume the user understands
the potential for danger, yes?  The only reason I want a
debug.userdump() or something like that is just so I can view the
contents of the userdata.

Just viewing is fine. The problems start when you transfer a userdata with an embedded pointer in it and use it in the other lua state.

 It's especially important when a
third-party library hoists a struct into Lua as userdata but not an
API to introspect it.  I dislike having to turn to a third-party
module for something this simple, I wish it were part of the Lua's
core -- but it has obvious security concerns so that's why I relegated
it to somewhere like the debug library.


Philipp