[prev in list] [next in list] [prev in thread] [next in thread]
List: lua-l
Subject: Re: Jumping out of a function without error semantics
From: Noah Watkins <jayhawk () cs ! ucsc ! edu>
Date: 2013-01-29 0:15:34
Message-ID: 597C481E-6793-4B08-A2C8-63D13C682870 () cs ! ucsc ! edu
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic