How to get the 2nd values?

From 2 sources
this is supposed to happen when you issue this command. Ie - gives beginning and ending.
> = string.find(“Hello Lua user”, “Lua”)
7 9
of course that command does not work as is.
So, I tried
v=string.find(“Hello Lua user”, “Lua”)
print(v)
and all I get is 7

If what they say is true, how do I get the 9?

Similarly
string.find(“hello Lua user”, “l+”)
should return 3 and 4 but all I get is 3.

How is this stored so I can get the 2nd value or possible other values??

Last question - in those sources they mentioned the output but did not say how it was stored, shouldn’t that have been included? or is that some basic thing I missed?

Thanks!
[import]uid: 159663 topic_id: 28149 reply_id: 328149[/import]

I even tried
z=string.format("%s",string.find(“hello Lua user”, “l+”))
print(z)
and it still gave me ONLY the 3.

[import]uid: 159663 topic_id: 28149 reply_id: 113739[/import]

Update!!! I solved it!!!
I put it into a table!
t={ string.find(“hello Lua user”, “l+”) }
print(t[1],t[2])

So, my question is, is that the ONLY way to get it?
I thought storing it in a string would do it, but it didn’t so, is this the only way?
[import]uid: 159663 topic_id: 28149 reply_id: 113741[/import]

Hi there, you can do either;
[lua]print( string.find(“Hello Lua user”, “Lua”) )[/lua]

OR;

[lua]t, v = string.find(“Hello Lua user”, “Lua”)
print (t, v)[/lua]

t is the starting character and v is the ending character.

Peach :slight_smile: [import]uid: 52491 topic_id: 28149 reply_id: 113800[/import]

But, if you don’t know how many times it is in there. The “ONLY” way to do it is store it into a table and then traverse the table.

Correct?

Thanks!
[import]uid: 159663 topic_id: 28149 reply_id: 114155[/import]