Hey guys, I recently posted a question about my non-working function and fixed some things. No errors in output, but it returns "nil". I'll be happy for any assistance!

local function SplitString(xString, xDeliminer)
	
	xString:match("(.*)" .. xDeliminer .. "(.*)")
	
	
end


var1, var2 = SplitString("Hey there!,Hello.", ',')

print(var1)

EDIT 1: Question solved, but what about if I wanted to do something like this?

local function SplitString(xString, xDeliminer, Output1, Output2)
	
	Output1, Output2 = xString:match("(.*)" .. xDeliminer .. "(.*)")
	
	return Output1, Output2
	
end


SplitString("First sentence!,Second one!", ",", MyVariable, SecondVariable)

(Returns nil)

2 comments

2

because the SplitString function doesn't return anything.

0

Thanks! (Btw, made an EDIT C:)