Types

  • The main types in the language are:

    • Numbers - represent real numbers in the IEEE 754 standard
        • Any operation with a result that gives an exact representation
        • must always give that representation
        • The IEEE 754 standard makes integers unnecessary
    • Strings - a sequence of characters

        • Strings are immutable values
        • When modifying a string a new string is always created
    • Boolean - have values false and true

        • Conditionals consider false and nil to be false values
        • Anything else is true
    • nil

        • nil is a non-value representing the absence of a useful value
    • Functions - a function can be assigned to a variable

    • Table - an associative array
  • The type function gives the type of a variable

print (type("Hello")) -- gives string print (type(true)) -- gives boolean local a = 10 local b = type(a) -- gives number print (b) print (type(b)) -- gives string