Hi I'm trying to use
[CODE]
local TeamPropP = {
}
TeamPropP = split( "Name-Bob-Joe-John-Sam-Steve-Ross", "-")
[/CODE]
which is throwing the error
[CODE]attempt to call global 'split' <a nil value>[/CODE]
I though it could be used according to [URL="http://lua-users.org/wiki/SplitJoin"]http://lua-users.org/wiki/SplitJoin[/URL]
I am used to python's spit('-') function. Could you help me define it using the method to split strings in lua?
Use string.Explode("-", "Name-Bob-Joe-John")
[code]
local str = "Hello there kind child"
local tbl = string.Explode( " ", str )
PrintTable( tbl )
[/code]
[url=http://wiki.garrysmod.com/page/Libraries/string/Explode]Reference - string.Explode wiki[/url]
[b]Edit:[/b] ninja'd
-snippe-
it works thanks!
[CODE]
local People = {
}
People = string.Explode( "-", "joe-john-sam-steve-ross" )
[/CODE]
Sorry, you need to Log In to post a reply to this thread.