I was working on my FileSearch library and the Edit_Atom() portion when I noticed something. Within the vars list there is a var called vars. At first I thought it was an infinite loop with it refering to itself but then realized that would probably overload the savefile. After some further tinkering it seems that vars contains a string that evaluates to "vars"
vars["vars"] == "vars"
Why is that in there?
ID:149685
Mar 8 2002, 12:02 am
|
|
Mar 8 2002, 6:33 am
|
|
'vars' is a var just like everything else. It's just a list containing all the vars of an atom, yet still a var none-the-less.
|
In response to Nadrew
|
|
Say that three times fast :p
The weird thing about it is what happens after you access vars for the third time. Meaning, I access vars to get a list of vars. Then I noticed that vars was in that list (because it is a var) so I clicked on that and it opened up another list of vars which also included a vars var. One last time I clicked on it but it didn't open it as a list. The last time it reported it as containing the value "vars". Is there some automatic feature that only allows you to access a list through itself once? I was just curious why it didn't keep giving me the vars list instead of stopping me after the second try and giving me "vars" as a value instead. |
In response to English
|
|
No, the first vars you clicked was a list, the second vars you clicked was an item in that list. The final vars you saw was the data stored in the vars variable in the vars list. vars[vars="vars"] or something like that...
~X |
In response to Xooxer
|
|
I believe that's correct.
var/varname = input("Pick a var")in vars - vars Might help it. |
In response to Xooxer
|
|
Try this:
mob verb Test_Vars() var/list/L = vars["vars"] world << "[L] : [L.len]" var/list/L2 = L["vars"] world << "[L2] : [L2.len]" var/list/L3 = L2["vars"] world << "[L3] : [L3.len]" var/list/L4 = L3["vars"] world << "[L4] : [L4.len]" It outputs this: /list : 39 /list : 39 /list : 39 /list : 39 My question is basically how it knows not to keep saving it. It saves it as a list, then saves it's "vars" as a list, then that lists "vars" is NOT saved as a list. That's where it stops. |