04.01.2018, 14:43
Hi,
I have a couple of addresses with the same tag and an event script which is attached to those addresses.
When the event script is executed is does something different depending on the address.
Initially I had the following (simplified):
That worked. However I wanted to use a variable for the addresses because this script needs to run on different LM and the addresses are different.
So I tried:
This does not work.
if I use a table instead of a and b like
This works.
I'm most surely overlooking the obvious?
I have a couple of addresses with the same tag and an event script which is attached to those addresses.
When the event script is executed is does something different depending on the address.
Initially I had the following (simplified):
Code:
c = event.dst
if c == '1/1/1' then log('a')
elseif c == '2/2/2' then log('b')
end
That worked. However I wanted to use a variable for the addresses because this script needs to run on different LM and the addresses are different.
So I tried:
Code:
a = '1/1/1'
b = '2/2/2'
c = event.dst
if c == a then log('a')
elseif c == b then log('b')
end
This does not work.
if I use a table instead of a and b like
Code:
d = {'1/1/1', '2/2/2'}
c = event.dst
if c == d[1] then log'a')
elseif c == d[2] then log('b')
end
I'm most surely overlooking the obvious?