self:is_type

Shared

Checks whether the instance belongs to the specified type


Syntax

local result = self:is_type(
    name
)

Parameters

TypeNameDescription
stringnameType to check against

Returns

TypeNameDescription
boolresulttrue if the instance matches the given type, false otherwise

Examples

Check the type of a thread instance
local entity = util.thread.create(function(self)
    self:sleep(2000)
end)

entity:resume()
core.engine.print("info", self:is_type("thread")) -- true
core.engine.print("info", self:is_type("database")) -- false

On this page