Community discussions

MikroTik App
 
tomahawk
just joined
Topic Author
Posts: 4
Joined: Tue Oct 24, 2023 9:29 am

Environment in Script List

Tue Dec 19, 2023 1:19 pm

When I execute
 
 /system/script/environment/
:global installedVerLease 24.11.23
Then a variable is saved, but the value changes, 0 is added to the value.

What I expect: variable installedVerLease, value 24.11.23
What I get: variable installedVerLease, value 24.11.0.23

Why is this happened?
How can I fix this?

Thanks for the answers in advance
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12014
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Environment in Script List

Tue Dec 19, 2023 2:06 pm

You completely forgot about the quotes surrounding the strings.
Not to mention that representing the date in that way is completely silly and inefficient.
 
tomahawk
just joined
Topic Author
Posts: 4
Joined: Tue Oct 24, 2023 9:29 am

Re: Environment in Script List

Wed Dec 20, 2023 9:44 am

You completely forgot about the quotes surrounding the strings.
Not to mention that representing the date in that way is completely silly and inefficient.
It's just an example, there was no question of anyone rating silly or not. The question was why an extra zero appears in the value. Also, if a value like 23.23 is added, the value will be stored as 23.0.0.23.
Even if you keep the value in quotes, yes, it will not be modified. But if you change the value of the variable through the winbox interface, the null will still be added. And I would like to understand why it works like that.
 
User avatar
vingjfg
Member Candidate
Member Candidate
Posts: 291
Joined: Fri Oct 20, 2023 1:45 pm

Re: Environment in Script List  [SOLVED]

Wed Dec 20, 2023 10:11 am

Likely because MT considers "7.1", "7.0.1" and "7.0.0.1" to be IP addresses.

Remember, there is no float in the scripting language.

Who is online

Users browsing this forum: No registered users and 5 guests