Revision Difference
any#560502
<cat>Dev.Lua</cat>
<title>any</title>⤶
⤶
The <page>any</page> keyword is not a type, because it represents all types that are not <page>nil</page>.⤶
⤶
In order to determine any, you can use the following code:⤶
⤶
```lua⤶
local isAny = type(x) ~= "nil"⤶
```⤶
<title>Concepts - Any Type</title>⤶
⤶
# Any (Data) Type⤶
"Any" type values are values who have some valid <page text="Type">Global.type</page>. They might be <page text="Numbers">number</page>, <page text="Strings">string</page>, <page text="Players">Player</page> or any other data type.⤶
⤶
The only things that do **not** fall under the label of "Any Type" are values of type <page text="nil">nil</page>.⤶
⤶
<example>⤶
<description>⤶
You can check if a variable is of Any Type by detected by checking the value's <page text="Type">Global.type</page> against the string "nil"⤶
</description>⤶
<code>⤶
-- Assume that the variable `suspiciousData` contains a "nil" type value⤶
local isDataAnyType = type( suspiciousData ) ~= "nil"⤶
⤶
-- Prints: false⤶
print( isDataAnyType )⤶
</code>⤶
</example>