Re: Pure Lua tables
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Pure Lua tables
- From: Dirk Laurie <dirk.laurie@...>
- Date: 2017年10月15日 18:58:47 +0200
2017年10月15日 17:43 GMT+02:00 Soni L. <fakedme@gmail.com>:
>
> I'm reading the Lua code, and it seems that Lua always checks the hash part,
> even for tables that don't use it. Why is this?
That's not how I read the code. Here are the comments and return
statements of luaH_next.
/* find original element */
/* try first array part */
/* a non-nil value? */
...
return 1;
}
/* hash part */
/* a non-nil value? */
...
return 1;
...
return 0; /* no more elements */
It's quite possible to return without reaching the code dealing with
the hash part.