Built-in Global Function

The function name Function type signature (return type (parameter function list)) describe

print: (…) => nil Standard output parameters, encountered table or function, output type name: 0000000000000000

pprint: (…) => nil Standard output parameter after tojsonstring results

type: (object) => string According to the run-time parameter type output parameter type corresponding string, return number, string, table, function, boolean, encountered other types of parameters, return to the previous five corresponding string

Such as:

let a1 = 1
let a2 = type(a1) -- The a2 value is' number ', the int and number of the runtime, and the type function returns 'number'.
let b1: object = 1
let b2 = type(b1) -- The b2 value is' number 'because the runtime type is used
type Person = {}
let c1 = Person()
let c2 = type(c1) -- The c2 value is' table ', the table and record type at runtime, and the type function returns' table'

require: (string) => object References to other modules, and not as a contract reference, the referenced module is loaded after the result of the return as a result of the require function

import_contract: (string) => table To reference the contract, the parameter is the name string of the contract and returns the table corresponding to the contract

emit: (string, string) => nil Throw an event event, recorded by the block chain

exit: (object) => object End the run, the parameter is the end code

pairs: (table) => object Returns the iterator of the table, traversing the order is to traverse the array part and then traverse the hash table part of the hash table part of the key key in the string before the traversal, the same string type key, short string in the long string before , The same length of the string key, according to ASCII characters from small to large

ipairs: (table) => object Return the iterator of the array of tables

error: (…) => object error

getmetatable: (table) => table

tostring: (object) => string Turn the parameter into string, for table and function, return type name: 0

tojsonstring: (object) => string Turn the parameter into a json string, for the function, return function: 0, for the nested table in the table, if there is a circular reference, use the ‘address’ substitution value.When json is used, the hash table will be small to large in order of the character of the key, and then the sequence of characters from left to right.For empty table, return “[]”

tonumber: (object) => number Turn the parameter into number, run into a string, read the number from the string, encounter an unparsed string or table or function, and return nil

tointeger: (object) => int Turns the argument into an integer, encounters a string, reads an integer from the string, encounters an unparsed string or table or function, returns nil

todouble: (object) => number Turn the parameter into number type and return nil with an unparsed value

toboolean: (obj) => bool Turn the parameter obj into a Boolean value, and obj returns false on false or nil, otherwise it returns true

totable: (object) => table Use the parameters as table, and if the parameter is not table return nil, it is mainly used to compile the static type conversion

next: (…) => object Move iterators to the next step

rawequal: (object, object) => bool Directly compare whether the two values are the same value (= = comparison is preferred to use the __eq__ function)

rawlen: (object) => int Gets the length of the array of a table directly

rawget: (object, object) => object Gets a property of a table directly

rawset: (object, object, object) => nil Set a property of a table directly

select: (…) => object When the index for the digital will return all the index greater than the index parameters: such as: select (2, “a”, “b”) returns “b”. When the index is a “#”, returns the number of total in the parameters (not including the index)

setmetatable: (table, table) => nil Set the table’s meta-table