natiny.script.to_number
natiny.script.to_number(value) -> number
Reads a value as a number: a number is itself, a boolean is 1 or 0, and
anything else is 0.
Parameters
| Name | Type | Description |
|---|---|---|
value |
any |
What to read |
Returns
| Type | Description |
|---|---|
number |
The number, or 0 |
Example
local width = natiny.script.to_number(
natiny.script.table_get(mod, config, "width"))
if width == 0 then width = 1280 end