Module cReflection
Pull off some API tricks to achieve reflection-alike abilities.
##
Functions
copy_object_properties (from_class, to_class, level) | Copy properties from one class instance to another |
cast_value (val, val_type) | cast variable as basic datatype (boolean,number,string) |
get_object_properties (class, level) | get properties from class instance |
get_object_info (class) | get information about native object (renoise API) |
is_standard_type (val) | |
set_property (str, value) | evaluate string, assign value to the resulting object |
is_valid_identifier (str) |
Functions
- copy_object_properties (from_class, to_class, level)
-
Copy properties from one class instance to another
Parameters:
- from_class (userdata)
- to_class (userdata)
- level (int) for internal use
Returns:
-
bool, true when copied
- cast_value (val, val_type)
-
cast variable as basic datatype (boolean,number,string)
Parameters:
- val
- val_type
- get_object_properties (class, level)
-
get properties from class instance
Parameters:
- class (userdata)
- level (int) internal counter
Returns:
-
table
- get_object_info (class)
-
get information about native object (renoise API)
Parameters:
- class
Returns:
-
int, or nil if not a recognized type
- is_standard_type (val)
-
Parameters:
- val (string), the type we want to check
Returns:
-
int, or nil if not a recognized type
- set_property (str, value)
-
evaluate string, assign value to the resulting object
Parameters:
- str (string), e.g. "renoise.song().transport.keyboard_velocity"
- value (vararg), any basic lua type
Returns:
- boolean, string (error message when failed)
- boolean, string (error message when failed)
- is_valid_identifier (str)
-
Parameters:
- str (string), name of indentifier
Returns:
-
boolean, string (error message when failed)