lua-users home
lua-l archive

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


> Roberto Ierusalimschy <roberto@inf.puc-rio.br> 于2020年9月2日周三 下午11:52写道:
> >
> > What do you mean by "safe"? What is exactly your concerns?
> 
> I mean, if the C stack unwind before calling __close when raising an
> error, the pointer is unsafe. because it's on the C stack.

You are thinking in the wrong abstraction level. When Lua calls __close,
the table containing the pointer is given as a parameter. So, it is
in slot #1, as valid as it was before the call. Lua never collects
an object and uses it afterwards.

-- Roberto