Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to check if the given value is a list/table or not?

I am currently working on a library in roblox, and i have a question i want to check i want to check if the value i put in a function is an array or not? if it's in an array then it will return a true and if it's not it will return a false.

1 answer

✓ Accepted answer

type returns type of given value:

local function CheckIfGivenValueIsTableAndIfSoThenReturnTrueElseReturnFalse(Table)
	return type(Table) == "table"
end

the types for type are string, number, thread, table, function, nil, userdata and boolean. Roblox has implement it's own version which is typeof, type will return userdata for all of the Roblox Instances and libraries, typeof will return Roblox type name.

2 comments

0

Thx @imkirda

0

sob

This discussion is preserved as it was. New answers, comments, and votes are closed.