lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 05/06/2007 11:21, Eva Schmidt wrote:
I have a table with tables inside indexed like that
[...]
My problem now is that even if the table index exists already it is not found if the function is called for the second time - so every time the function is called the table will be newly created.

Can you provide a small _functional_ example showing the problem?

So I think my problem is, that I have to index the table with the same string object as before, not just with the same string.

No. What the Wiki says is that if you have the same string in two different parts of a script, they share the same object, ie. they point to the same internal buffer.

Does anybody have an idea how to realize that as smart as possible? Maybe some kind of a hash table ...?

Lua already hashes strings, that's how it sees strings are the same.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --