Std Lib¶
std-lib
Import¶
import "_IVLS/std-library/std-lib.ksp"Node: Stl.Lib¶
Uses: Init, TimerMsTick, UIOpen, UIClose
Overview¶
std-lib
Top-level entry point for the IVLS Standard Library — aggregates all STL node packages, declares core boolean and condition helpers, and runs initialization through Stl.Lib and Stl.Lib_Post.
API¶
Nodes¶
| Name | Description |
|---|---|
node Stl.Lib |
Core standard library initialization node; declares global state, common arrays,... |
node Stl.Lib_Post |
Post-initialization node that prints total object RAM load when in developer mod... |
Defines¶
| Name | Description |
|---|---|
define BOOL.FALSE |
Boolean FALSE expression — always evaluates to false. |
define BOOL.TRUE |
Boolean TRUE expression — always evaluates to true. |
define CASE.ELSE |
KSP select/case else range covering all 32-bit integer values not matched by pri... |
define CONDITION.IS_BOOL(#i#) |
Returns TRUE if the integer #i# is a valid boolean value (0 or 1). |
define Ivls.STL |
Aggregate define of all STL node packages for inclusion in a product. |
define UI.NULL |
UI ID of the null_widget — a hidden button used as a safe null target for UI ass... |
define use_ram_report |
Expands to lib.is_dev_mode() — true when the product is running in developer mod... |
Macros¶
| Name | Description |
|---|---|
lib.MakeRamReport(#name#) |
Declares a RAM report label for #name# and positions it in the ram_panel grid, i... |
Functions¶
| Name | Description |
|---|---|
lib.get_last_touched() -> result |
Returns the ENGINE_UPTIME value recorded at the most recent touch event. |
lib.get_time_elapsed(ms_interval) -> time |
Returns TRUE if the engine uptime has advanced more than ms_interval millisecond... |
lib.is_dev_mode() -> result |
Returns whether the product is running in developer mode. |
lib.touch_listener() |
Updates LAST_LISTENER_TIME to the current ENGINE_UPTIME, recording the moment of... |
TO_MB(x) -> str |
Formats a byte count as a human-readable megabyte string with one decimal place. |
TO_MB_ENC(x) -> y |
Encodes a byte count as a fixed-point millibyte integer for display. |
Nodes¶
node Stl.Lib¶
Callbacks: Init, TimerMsTick, UIOpen, UIClose
Core standard library initialization node; declares global state, common arrays, constants, and the null widget.
node Stl.Lib_Post¶
Callbacks: Init
Post-initialization node that prints total object RAM load when in developer mode.
Defines¶
define BOOL.FALSE¶
Boolean FALSE expression — always evaluates to false.
define BOOL.TRUE¶
Boolean TRUE expression — always evaluates to true.
define CASE.ELSE¶
KSP select/case else range covering all 32-bit integer values not matched by prior cases.
define CONDITION.IS_BOOL(#i#)¶
Returns TRUE if the integer #i# is a valid boolean value (0 or 1).
| Parameter | Type | Description |
|---|---|---|
#i# |
integer | The value to check |
define Ivls.STL¶
Aggregate define of all STL node packages for inclusion in a product.
define UI.NULL¶
UI ID of the null_widget — a hidden button used as a safe null target for UI assignments that must reference a valid widget.
define use_ram_report¶
Expands to lib.is_dev_mode() — true when the product is running in developer mode, controlling whether RAM usage is reported.
Macros¶
lib.MakeRamReport(#name#)¶
Declares a RAM report label for #name# and positions it in the ram_panel grid, incrementing the panel count.
| Parameter | Type | Description |
|---|---|---|
#name# |
string | The identifier used to name the UI label and display in the report |
Functions¶
lib.get_last_touched() -> result¶
Returns the ENGINE_UPTIME value recorded at the most recent touch event.
Returns: result — The uptime timestamp of the last touch event
lib.get_time_elapsed(ms_interval) -> time¶
Returns TRUE if the engine uptime has advanced more than ms_interval milliseconds since the last touch event.
| Parameter | Type | Description |
|---|---|---|
ms_interval |
integer | Elapsed millisecond threshold to test |
Returns: time — 1 if the interval has elapsed, 0 otherwise
lib.is_dev_mode() -> result¶
Returns whether the product is running in developer mode.
Returns: result — 1 if dev mode is active, 0 otherwise
lib.touch_listener()¶
Updates LAST_LISTENER_TIME to the current ENGINE_UPTIME, recording the moment of the most recent touch event.
TO_MB(x) -> str¶
Formats a byte count as a human-readable megabyte string with one decimal place.
| Parameter | Type | Description |
|---|---|---|
x |
integer | Byte count to format |
Returns: str — Formatted string, e.g. "1.5"
TO_MB_ENC(x) -> y¶
Encodes a byte count as a fixed-point millibyte integer for display.
| Parameter | Type | Description |
|---|---|---|
x |
integer | Byte count to encode |
Returns: y — Encoded millibyte value
Example¶
// TODO: Add usage example