[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Pass vars value not reference to table.insert
- From: David Given <dg@...>
- Date: Sat, 27 Jan 2007 15:48:55 +0000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jan Schütze wrote:
[...]
> The following pseudo code won't add every 3 rows to the table rows,
> because row is a variable so rows would contain one item, and 3 pointers
> to it.
> rows={}
> local row = fetchRow()
> while (row) do
> table.insert(rows,row)
> row = fetchRow()
> end
The only way you'd end up with the same item three times is if fetchRow()
were somehow returning the same item every time. It's not reusing the same
table to return each item, is it --- can we see the implementation?
- --
┌── dg@cowlark.com ─── http://www.cowlark.com ───────────────────
│ "There is nothing in the world so dangerous --- and I mean *nothing* ---
│ as a children's story that happens to be true." --- Master Li Kao, _The
│ Bridge of Birds_
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with MultiZilla - http://enigmail.mozdev.org
iD8DBQFFu3Rnf9E0noFvlzgRAqwyAKCcqhtJ33uE2rgKWcZ0pWN3cnygDACfeJ2/
ArP4T0P73WTQeQ7/65KfEmU=
=5ego
-----END PGP SIGNATURE-----