array

Syntax: %array(values)

return an array filled with values. Only the #VAR command can store an array. You can also pass an array to any of the COM/OLE functions.

Examples:

#VAR a %array(1,2,3)

creates an array of 3 elements. The first element (element 0) has a value of 1, the second has a value of 2, etc.

#VAR a %array(1,"hello",3)

creates an array of 3 elements. The first element (element 0) has a value of 1, the second has a value of "hello", etc. Notice that you can mix both numbers and strings in the array contents.

#VAR zmud %comcreate("Zmud.Application")
#VAR ss %comget(zmud,"CurrentSession")
#COM ss "zMUDCommand" 216 %array("varname","value")

ok, here's a tricky one. This is COM code. First we store a link to the COM Server "Zmud.Application", which is zMUD itself. Then we access the "CurrentSession" property of zMUD and store that session in ss. Then we execute the "zMUDCommand" method of the current session. The zMUDCommand method takes two arguments: the first is the command ID to use. These IDs are documented in the ZMUD.INC file in the Developer's Kit. ID number 216 corresponds to the #VAR command. The second argument for zMUDCommand is an Array of values to pass to the command. In this case, we pass an array with the elements "varname" and "value". So, this ends up executing: "#VAR varname value" which will create a variable in the current session.

Note a very practical example, but it *does* show how you use %array in a COM statement if you need it.



Contents ansi arrget