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

How can you tell if a value is a table?

Asked by 8 years ago

Say your making a script and by the end of it you tell it to return a value. You don't know what kind of value it is but you hope it's a table. How would you go about confirming that the value is a table?

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
8 years ago

By using the type function!

tab = {}
print(type(tab))

if type(tab) == "table" then
    print("This will print!")
else
    print("but this won't! D:")
end
0
Thanks... I completly forgot about the "type" function... :/ ClassicTheBlue 65 — 8y
Ad

Answer this question