When the concatenation operator is used, Lua converts a number into a string. If the string cannot be converted to a number, an error is raised. For example, if you try to apply an arithmetic operation to a string, Lua will try to convert that string to a number first, otherwise, the operation will not work. Lua will automatically convert the string and number types to the correct format in order to perform calculations. In Lua, this is either from a string to a number or a number to a string. “Type coercion” is the implicit or automatic conversion of a value from one type to another.
0 Comments
Leave a Reply. |