Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to check if something is a table/array?

Asked by 7 years ago
Edited 7 years ago

Is it possible to check if a value is a table/array?

Let's say I want to send a value through a remote event, In the remote event how would I check if the value is a table or not?

1 answer

Log in to vote
3
Answered by 7 years ago
Edited 7 years ago

There is a built in function called typeof(val) that can be used for this purpose.

local x = 3
local y = {t=5}
local z = nil
print(typeof(x),typeof(y),typeof (z)) --> number table nil
0
Thank you! NovaMagic 73 — 7y
0
@NovaMagic no problem Thundermaker300 554 — 7y
Ad

Answer this question