[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LUA_USE_APICHECK
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 26 Aug 2011 10:13:11 -0300
> > The manual doesn't say that non-acceptable indices should return NULL.
>
> In my opinion it does.
>
> "If the value at the given acceptable index is a full userdata,
> returns its block address. If the value is a light userdata, returns
> its pointer. Otherwise, returns NULL"
>
> This english compiles into pseudo-code
>
> if valid(index) and valueat(index) == userdata then return block address
> elseif valid(index) and valueat(index) == light userdata then return pointer
> else return NULL.
>
> So an invalid index returns NULL.
Of course, being English a natural language, practically any sentence is
subject to multiple interpretations. But I, as a non-native speaker,
would read that sentence like this:
"If the value at the given acceptable index is a full userdata, returns
its block address. If the value [at the given acceptable index] is a
light userdata, returns its pointer. Otherwise [that is, both cases
are false: the value at the given acceptable index is neither a full
userdata nor a light userdata], returns NULL."
-- Roberto