This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

String split question
#1
Hi

I need to extract the last part of different group names. I use the string.split() for this. What I get is for example; 

Code:
kode = string.split(grp.find(event.dst).name, ' ')


* table:
[1]
  * string: 08-09
[2]
  * string: UTE+08=564.004-RM003-UTE
[3]
  * string: BLIND
[4]
  * string: vest
[5]
  * string: ALARM_WIND


I always want to get the last part of the string, but there are not the same number og spaces in every group name, and so I need to always get the last string in the table. For this particulare example, I could just add [5] to get it, but in another group that might return nil or even the wrong part of the name.

So basically; how can I find the highest row number in the table?
There are 10 kinds of people in the world; those who can read binary and those who don't  Cool
Reply
#2
Code:
last = kode[ #kode ]
Reply
#3
(16.03.2020, 07:43)admin Wrote:
Code:
last = kode[ #kode ]
Perfect!
Thx!
There are 10 kinds of people in the world; those who can read binary and those who don't  Cool
Reply


Forum Jump: