lua-users home
lua-l archive

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


>       -- this will hang
>       p = 123
>       s = read(p,'*a')

That is bad. The type of file handle arguments should be checked.

>       -- this will give error
>       q = 'I love you'
>       t = read(q,'*a')

This is no problem: Lua 4.0 is assuming you're trying to use a Lua 3.2
read pattern

> So mytag becomes global and next time I can check if the
> pointer passed is a valid myuserdata.  But wait a minute.
> Someone can erase mytag or set it to something else.  So
> what really is the philosophy behind tag?

You should implement tags for userdata in a different way, e.g. the way
that the I/O library does: in particular, store the value in a C variable,
which can't be overwritten, not a Lua variable.

-- 
http://sc3d.org/rrt/ | Slow Pedestrian Crossing