use “3rd Party Plug-ins” paths
all scripts from these paths automatically load in the system.
the file with your libraries might be organized with structs and look like:
global GeneralMathOperations
(
struct GMathOperationsStruct
(
/** Two times the constant Pi defined as a float. */
TWOPI = 6.283185307,
/** Half of the constant Pi defined as a float. */
HALFPI = 1.5707963268,
/** The coefficient to convert the value of an angle in degrees into radians. */
DEG_TO_RAD = (PI/180.0),
/** The coefficient to convert the value of an angle in radians into degrees. */
RAD_TO_DEG = 180.0/PI,
/** A function macro to convert degrees to radians with float precision. */
fn _deg_to_rad deg = (deg * DEG_TO_RAD),
/** A function macro to convert radians to degrees with float precision. */
fn _rad_to_deg rad = (rad * RAD_TO_DEG),
on create do
(
)
)
global _math = GeneralMathOperations = GMathOperationsStruct()
ok
)
so you will get only one Global as instance of a struct
every tool (script) that uses this struct has to call methods as:
::GeneralMathOperations.halfpi
but if you use these methods many times in the code it might be clear and safer to use simple and locally unique name across whole code (for example):
rollout MyRollout "My Roillout"
(
local _math = if globalvars.isglobal #GeneralMathOperations do globalvars.get #GeneralMathOperations
/*
after that the rollout's body
where you can call :
_math.halfpi
*/
)