04.01.2018, 16:36
(04.01.2018, 16:25)Daniel. Wrote:(04.01.2018, 14:43)baggins Wrote: Hi,hm..
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
This works.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?
your first script work but the second with table should not as you miss ( in third line next to log.
That is a typo in the example... In reality this works, but the second script with a 'normal' variable does not work and I cannot figure out why.