Page 1 of 1

Storing more values in one variable

Posted: Saturday 18 August 2018 17:59
by DutchHans
Good evening everyone,

Months ago a read here on the forum that someone explained how to store more values in one variable, I believe I remember something with devided by semicolons... I can't find it here on the Forum anymore..

Can someone put me in the right direction.. writing and reading more than one value in/out of a uservariable.
ie. Titel,value1,value2,value3 all in one variable

Thanks in advance.
Hans

Re: Storing more values in one variable

Posted: Saturday 18 August 2018 19:41
by waaren
DutchHans wrote: Saturday 18 August 2018 17:59 ..
Months ago a read here on the forum that someone explained how to store more values in one variable, I believe I remember something with devided by semicolons... I can't find it here on the Forum anymore..
Do you ask this question for a specific language ?
In most programming languages you can store many values in a table or in a string. The table approach is native but for the string approach you need functions to store and retrieve the individual values.

Re: Storing more values in one variable

Posted: Saturday 18 August 2018 20:56
by DutchHans
Sorry,

It was in Lua...as far as I know.

Regards, Hans

Re: Storing more values in one variable

Posted: Saturday 18 August 2018 21:12
by jvdz
I am using something like this:

Code: Select all

totalcontent=uservariables['Variable-Name']
for Name in string.gmatch(totalcontent, "[^|]+") do
	print('Name :'..Name)
end
This is using the verticalbar character as delimiter, so just use the one you like.
Jos

Re: Storing more values in one variable

Posted: Sunday 19 August 2018 15:53
by DutchHans
Thank you, i will giv it a try

Gr,Hans