|
From: | Alex Queiroz |
Subject: | Re: [Monotone-devel] PATCH: note_netsync_revision_received apparently missing author cert |
Date: | Tue, 13 Mar 2007 09:58:44 -0300 |
Hallo, On 3/13/07, Bruce Stephens <address@hidden> wrote:
Except that tables in Lua count from 1, not 0. I don't know why---seems an odd choice to me. (And IIUC, it's by convention of the various functions like ipairs, etc., not something more fundamental.)
Since you can use almost anything as a table key (the exception being nil), the choice of the first "natural" numeric key had to be arbitrary. There is nothing odd to it, 1 is as good a choice as 0. And ipairs is faster than pairs, because it uses only the array part of a table (tables in Lua are composed of an array part and a hash part, so integer-indexed tables are almost as fast as C arrays). So it would be better to just use Lua as it's supposed to be. Cheers, -- -alex http://www.ventonegro.org/
[Prev in Thread] | Current Thread | [Next in Thread] |