Attempt to connect nil with string

--This one turns a date (X/XX/XXXX) into a table
module.ConvertDateToTable = function(Date : string)
	local DataToReturn = {
		Day = 0,
		Month = 0,
		Year = 0
	Date = string.split(Date, "/")
	DataToReturn.Day = Date[1]
	DataToReturn.Month = Date[2]
	DataToReturn.Year = Date[3]
	return DataToReturn

--This one SHOULD turn a table containing the date back INTO a format like "X/XX/XXXX"
module.ConvertTableToDate = function(DateTable)
	return DateTable[1].."/"..DateTable[2].."/"..DateTable[3]

So basically for the first function you input 1/15/2028 and then it returns {Day = 1, Month = 15, Year = 2028} And that function works

And for the second function you input a table like {Day = 13, Month = 3, Year = 2099} and it returns a “date” format like 13/3/2099 But this function does NOT work

If anyone can help, thanks

1 Like

return DateTable[Day]…“/”…DateTable[Month]…“/”…DateTable[Year]
^ this is another way to get the tables data w/o index

in ConvertTableToDate, you should try to print the table, and try to print all 3 of the items from the table (via:)

print(DateTable, DateTable[1], DateTable[2], DateTable[3])

this would show what is nil

1 Like

why is it saying nil but also its not nil?


thats because 1,2 and 3 DO NOT exsist in the table

do this: return DateTable[Day]…“/”…DateTable[Month]…“/”…DateTable[Year]

the old method would have the table looking like this:
[1] = “1”,
[2] = “30”,
[3] = “2098”

1 Like

its still returnng nil for some reason


return DateTable[“Day”]…“/”…DateTable[“Month”]…“/”…DateTable[“Year”]

oops, sorry i didn’t wrap the values in quotes

i have a script that just activates those funcs, and it works now!

Thank you

1 Like