(24.04.2024, 13:51)fleeceable Wrote:(24.04.2024, 12:50)tomnord Wrote: Hello. I have a float value, with formatting 00.00. I need to separate the value at '.' . and on the other end, I need to merge them again.
Example: value read from GA= 12.02, values in script: val1=12 and val2= 02
Possible?
Should work...Code:value = grp.getvalue('57/0/1')
--Split by dot
tab = string.split(value, ".")
log(tab)
--Merge into 2byte
if #tab >1 then
grp.update('57/0/2', tab[1] .. '.' .. tab[2])
else
grp.update('57/0/2', tab[1])
end
Thanks, I'll try. But i thought the string.split only worked on strings, not floats.
(25.04.2024, 06:02)tomnord Wrote:(24.04.2024, 13:51)fleeceable Wrote:(24.04.2024, 12:50)tomnord Wrote: Hello. I have a float value, with formatting 00.00. I need to separate the value at '.' . and on the other end, I need to merge them again.
Example: value read from GA= 12.02, values in script: val1=12 and val2= 02
Possible?
Should work...Code:value = grp.getvalue('57/0/1')
--Split by dot
tab = string.split(value, ".")
log(tab)
--Merge into 2byte
if #tab >1 then
grp.update('57/0/2', tab[1] .. '.' .. tab[2])
else
grp.update('57/0/2', tab[1])
end
Thanks, I'll try. But i thought the string.split only worked on strings, not floats.
It kinda works, but the last decimal does not write odd numbers. example, I write 23.53, the value written is 23.52, the same with 23.55, ends up as 23.54.. It only happens when main number is above 20
Logged value in "tab" shows correct numbers.