lua-users home
lua-l archive

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


>> Does calling 'error' impair garbage collection in any way?

> No


>> if I had some user data referenced in a function that calls error would
>> such user data be collected properly?

> [and] yes.

'error' does not impair the VM at all (unless it is called in
unprotected mode, yielding to a panic exit). It unwinds the stack,
leaving everything in perfect conditions to proceed executing. You can
call as many "errors" as you want, whenever you want (even from inside C
code), and you should not be able to achieve an unconsistent state.
(Again, the exception being if you call error in unprotected mode,
that is, outside any call to pcall or lua_pcall.)

-- Roberto