larryllix Posted November 6, 2019 Posted November 6, 2019 It would be really nice to have access to a variable's storage position. This would allow minor variable array techniques and table creation using simple techniques. The variable's position could be written to another variable and also read from another variable or set explicitly from a program. This should be less complex than implementing indexed variable access where a base value and an offset value would be required in any line using that style. eg. Saving a variable's position $Index = VarPosition $sDayOfWeekOnTime Repointing an access to a variable table$sDayOfWeekOnTime = $Index This would allow users to scale a small array table for values. eg. of integer variable array usage - a 7 day time chartPos. Name Value 12 $Index 15 <-------points to $Wed.OnTime 13 $Mon.OnTime 8.30 14 $Tue.OnTime 8.45 15 $Wed.OnTime 7.30 16 $Thu.OnTime 7.45 17 $Fro.OnTime 9.15 18 $Sat.OnTime 9.05 19 $Sun.OnTime 7.45 $Index = position of $Wed.OnTime $XXXXXX = valueAt $Index <---------------- would assign the value 7.30 to the variable $XXXXXX $Index += 1 <----------------- now points to $Thu.OnTime $YYYYYY = valueAt $Index <---------------- would assign the value 7.45 to the variable $YYYYYY Protecting limits would be the users responsibility, although run away array writing could be a problem, without some system protections against runaway variable table writing or reading. Thanks UDI!!!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.