-
Posts
2 -
Joined
-
Last visited
Content Type
Forums
Blogs
Knowledge Base
Posts posted by Toph Bailey
-
-
Hello-
I am an experienced programmer in PHP. I've enjoyed using LSL so far, but one thing that I have relied upon in other languages still seems to escape me in LSL. What about associative arrays? For example, in PHP I might do the following:
<?php $avatarName = "Toph Bailey"; // string avatarName = "Toph Bailey"; $c = array($avatarName=>1); // list c = [avatarName, 1]; ???? echo $c[$avatarName]; // llSay(0, llList2String(avatarName, avatarName)); ???? ?>
In other words, rather than letting index be limited to an integer range from 0 to (mag-1) of a list, could the index instead be a string (label)? This would have enormous benefit for a lot of short-term data storage, such as recent visitors, or scoreboards (until script was reset).
To be forthright, I am trying to write a scorecard that tracks simple clicks from local objects and associates a counter with each avatar's name in an associative list. So far this data type's one-dimensional nature has evaded my comprehension. Am I approaching this from the right angle?
Thank you for any insight!
LSL Associative Array
in LSL Scripting
Posted
Thank you both for the tips, I've really learned a lot already experimenting with these ideas!