[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: C API - lua_next traversal of "array" table
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 19 Aug 2016 12:07:58 -0300
> On 19 August 2016 at 11:22, ThePhD <email@example.com> wrote:
> > I don't suppose sneaking in some kind of ridiculous key name that includes
> > null characters and other things that are vastly improbable for a real Lua
> > user to use (something like "__detail.do.\0.not.touch\xE2\x98\xA2.size") for
> > when I push the table and then pop the table, and using that MAYBE as a
> > shortcut if it's present, and otherwise falling back to iterating until I
> > hit a `nil` might be worth it...?
> Aren't you already iterating? and hence the cost is the `nil` check...
> (with lua_isnil).
> If you're already checking the lua_type of your values, it would be 'free'.
It is always free now. lua_geti already returns the type of the value.