Vertex Scripts
ModulesTypeCheck

Shared

Checks if a value is of a certain type

vx.typeCheck

vx.typeCheck(name, value, expectedTypes)
  • name: string
  • value: any
  • expectedTypes: type | type[]

Example

-- Works fine
local world = { hello = 4 }
vx.typeCheck("world", world, "table")
 
-- Throws an error: expected world to have type 'string' (received table)
vx.typeCheck("world", world, "string")

On this page