Module classes.vLib
This class provides static members and methods for the vLib library
uid_counter |
(int) when you instantiate a vLib component, it will register itself
with a unique viewbuilder ID. |
lazy_updates |
(bool) when true, complex widgets will schedule their updates,
possibly saving a little CPU along the way |
DEFAULT_BMP |
specify a bitmap which is *guaranteed* to exist (required when
creating bitmap views before assigning the final value) |
Functions
-
generate_uid ()
-
generate a unique string that you is used as viewbuilder id for widgets
(avoids clashes in names between multiple instances of the same widget)
Returns:
string, e.g. "vlib12"
-
unpack_args (...)
-
used for unpacking constructor arguments
Parameters:
Returns:
table
-
within_range (val, val_min, val_max)
-
function to ensure that a value is within the given range
Parameters:
- val
(number)
- val_min
(number)
- val_max
(number)
Returns:
bool
-
scale_value (value, in_min, in_max, out_min, out_max)
-
function to scale a value from one range to another
Parameters:
- value
(number)
- in_min
(number)
- in_max
(number)
- out_min
(number)
- out_max
(number)
Returns:
number
-
get_fractional_value (value)
-
get fractional (decimal) part of a number
Parameters:
Returns:
number
-
round_value (num)
-
round_value (from http://lua-users.org/wiki/SimpleRound)
Parameters:
Returns:
int
Fields
-
uid_counter
-
(int) when you instantiate a vLib component, it will register itself
with a unique viewbuilder ID. This is the global incrementer
-
lazy_updates
-
(bool) when true, complex widgets will schedule their updates,
possibly saving a little CPU along the way
-
DEFAULT_BMP
-
specify a bitmap which is *guaranteed* to exist (required when
creating bitmap views before assigning the final value)