From: "Carlo Hogeveen"
Arrays can be simulated in TSE with:
setglobalint(array_name + str(index_value), new_element_value)
and:
if existglobalvar(array_name)
old_element_value = getglobalint(array_name + str(index_value))
else
old_element_value = 0
endif
Hint: To assure that array_name will always be unique across macro's,
start array_name with the macro_name.
The same method can be used to create:
- arrays of strings.
- arrays of struktures, by adding field_names to the array_name.
- multidimensional arrays, for example seperating the multiple
indexes by an underscore.
DelGlobalVar("Carlo")
----------
: From: James C. Sewell
: To: tsepro@semware.com
: Subject: SAL programming
: Date: woensdag 25 juni 1997 21:40
:
: Suggestion: Add integer arrays to SAL
:
: Question 1: What is the range for BufferId()'s?
:
: Question 2: What is the best way to emulate integer arrays?
:
: Question 3: What is a better way to implement my function?
:
:
: I need to set a flag on/off for each of the buffers in my ring.
: GetBufferId() gives me a reference number for the buffer, but
: that is a seemingly random number that starts out around 20 or
: so... usually.
:
: My first thought, before realizing the unpredictability of these
: buffer numbers, was to have a string[10] and for each buffer set
: string[buffer number] to "1" or "0". This works, but considering
: the id's I'd have to make string's size really big and I prefer
: not to do that. Besides that, what if a buffer id is bigger than
: 255 (the biggest string)... then my routine fails and someone loses
: data. A Bad Thing.
:
: Open to suggestions...
: Jim
:
: This answer, and my routine, may be a good tutorial in the near
: future...
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|