lua-users home
lua-l archive

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


On Jan 28, 2013, at 12:48 PM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:

>> Given that we use lua_error for our abort semantics, and probably soon to be our commit, too, is there a good programming pattern that can be used to ensure that Lua cannot 'fake' one of these calls using error(?), forcing them to always go through our interface? Would a piece of user data on the stack prior to lua_error do the trick?
> 
> Most probably. But note that you'll need to be able to compare the Lua value
> raised as an error with your special value, so perhaps it's best to store
> that value in the registry.

I like the idea of storing this in the registry to communicate back to lua_pcall the situation. Under some circumstance, a Lua code may use pcall(context.abort), in which case we'd like to either know to not set the registry flag, or be able to clear it. How might this case be handled?

-Noah