If value is a string it will be converted to a float if possible. An invalid value is returned as 0
f = as_float(4.0) // 4.0
f = as_float(4) // 4.0
f = as_float("4") // 4.0
f = as_float("barb") // 0.0
f = as_float(null) // 0.0
f = as_float(true) // 1.0
f = as_float([1,2,3]) // 0.0
as_int(value)
Returns the value as a int
If value is a string it will be converted to a float if possible. An invalid value is returned as 0
f = as_int(4.0) // 4
f = as_int(4) // 4
f = as_int("4") // 4
f = as_int("4.0") // 4
f = as_int("barb") // 0
f = as_int("27th") // 27
f = as_int(null) // 0
f = as_int(true) // 1
f = as_int([1,2,3]) // 0
as_string(value)
Returns the value as a string
If value is a string it will be converted to a float if possible. An invalid value is returned as null
f = as_string(4.0) // "4.0"
f = as_string(4) // "4"
f = as_string(null) // null
f = as_string(true) // "1"
f = as_string(4.0) // "4.0"
f = as_string([1,2,3]) // null
as_point(x,y) | point(x,y)
Returns a point with x and y coordinates`
local p = point(10,20)
as_point has the added benifit of being able to convert a string to a point
local p = as_point("{100, 200}")
If the string is an invalid point, point(0,0) will be returned.
is_table(value)
Returns true if value is a table
is_array(value)
Returns true if value is a array
is_string(value)
Returns true if value is a string
is_int(value)
Returns true if value is a int
n = is_int(4) // true
n = is_int(4.0) // false
is_float(value)
Returns true if value is a table
n = is_int(4) // false
n = is_int(4.0) // true
is_point(value)
Returns true if value is a point
p = point(100,100)
n = is_point(p) // true
is_number(value)
Returns true if value is a float or int
n = is_number(4) // true
n = is_number(4.0) // true
n = is_number("4") // false
n = is_number(null) // false