string.byte. How do i collect the values?

Hi!
How do i collect the values that i recieve when i’m using the function string.byte ?

for example :

Its easy when i’m working with a static number of letters :

local sentence = “Hello”
local byte1,byte2 = sentence:byte(1,2)

but what if the length of the text is dynamic?
How can i collect the values without having to declare a variable for each letter?

[import]uid: 103182 topic_id: 22293 reply_id: 322293[/import]

Grab the length and use a for loop. Try running this;

[lua]local myString = “This is my string”

byte = {}

for i = 1, string.len(myString) do
byte[i] = myString:byte(i)
print (byte[i])
end[/lua]

Peach :slight_smile: [import]uid: 52491 topic_id: 22293 reply_id: 89017[/import]

Thanks Peach!
So there is no other way then? I thought that maybe there is a more efficient way to collect multiple values that you recieve from for example localToContent, contentToLocal and :byte.

[import]uid: 103182 topic_id: 22293 reply_id: 89117[/import]