This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Comparing event.dst to a variable
#1
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):

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
This works.

I'm most surely overlooking the obvious?
Reply


Messages In This Thread
Comparing event.dst to a variable - by baggins - 04.01.2018, 14:43

Forum Jump: