Sorry - yesterday was a long and miserable day of coding and I was snappy - I shouldn't have been so snippy!!
I'm amazed you got that to work too - in every case I tried (and I tried a LOT!) it broke before renaming every element for me...
The best it ever did was rename 9 out of 15 entries I had in the table at the time - reload would rename another few and so on....
I'd assumed that pairs() somehow 'remembered' where it was in the table (using a pointer or somesuch thing) - so if you changed an element it was left with no idea where to go next...
You're also ADDING keys into the table which pairs() may - or may not - be aware of???
This feeds into something else I'm interested in but can find no reference for - which is what ORDER something like pairs() will go through a (non numeric-indexed) table.
As best as I can tell it's random - I have a table (also a savedvariable) the content of which seldom changes - but the function I use to copy it's values into a string produces a different string every time I use it!!
e.g.
Table keys "FRED", "BARNET", "WILMA" will produce
"FredBarnetWilma"
and then
"BarneyFredWilma"
after the next reloadui and then
"WilmaFredBarney"
and so on...
I know there are ways of sorting a table but I just wondered how it dealt with it normally??
|