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

I've been seeing this in a lot of scripts. The word 'type'. How do I use this?

Asked by 4 years ago

I've been wondering how to use 'type' as I've seen people using it so much. For e.g:

if type then
    --Do something
end

1 answer

Log in to vote
1
Answered by
ScuffedAI 435 Moderation Voter
4 years ago
Edited 4 years ago

Looks like you're having trouble googling that yourself, let me do that for you.

Type Function

In Lua, there is a function called ‘type’ that enables us to know the type of the variable. Some examples are given in the following code.


print(type("What is my type")) --> string t = 10 print(type(5.8*t)) --> number print(type(true)) --> boolean print(type(print)) --> function print(type(nil)) --> nil print(type(type(ABC))) --> string

Source

0
Thanks alot! ISkyLordDoge 37 — 4y
Ad

Answer this question