API ReferenceGE Extensionsflowgraphnodesutil
To Number
- **Node Name:** `To Number`
Overview
- Node Name:
To Number - Category:
simple - File:
extensions/flowgraph/nodes/util/tonumber.lua
Converts any input value to a number using Lua's tonumber(). As a simple category node, it requires no flow connections.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
value | any | - | Value to attempt to convert to a number |
Output Pins
| Pin | Type | Description |
|---|---|---|
value | number | Result of tonumber() conversion (may be nil) |
Internals
Key Methods
| Method | Description |
|---|---|
work() | Applies tonumber() to the input value |
How It Works
- Reads the input
valuepin (any type). - Calls Lua's
tonumber()on it. - Outputs the result. If conversion fails, output is
nil.
Usage Example
-- Convert string "42" to number 42:
-- value = "42" → output = 42
-- Convert boolean → nil (tonumber doesn't handle bools):
-- value = true → output = nil
-- Convert number passthrough:
-- value = 3.14 → output = 3.14Key Dependencies
tonumber()- Lua standard library
See Also
- Route Distance (Flowgraph Node) - Related reference
- Closest Road (Flowgraph Node) - Related reference
- Custom Lua (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide