LM Functions

The following functions are defined in the LM namespace. To call one of these functions, be sure to prepend

LM.
to the function's name. For example,
LM.Beep()
is valid, while
Beep()
is not complete.


void Beep()

Causes to computer to beep.

Return value: none

void Snooze(milliseconds)

Causes Moho to pause for the specified number of milliseconds.

milliseconds (int): duration to pause
Return value: none

int Round(value)

Returns the closest integer to the supplied value. In other words, value is rounded off.

value (float): a number to round
Return value (int): closest integer to the value passed in

float Clamp(value, min, max)

Clamps a value to ensure that it is within certain bounds. This function returns min if value is less than min, max if value is greater than max, and value otherwise.

value (float): a number to clamp
min (float): minimum acceptable value
max (float): maximum acceptable value
Return value (float): the clamped value

float Lerp(value, start, end)

This function is a shortcut for linear interpolation between two numbers. If value is 0, then start is returned. If value is 1, end is returned. For anything in between, the function interpolates between start and end.

value (float): a number between (and including) 0 and 1
start (float): the starting value to interpolate
end (float): the end value to interpolate
Return value (float): a linear interpolation between start and end

float Slerp(value, start, end)

This function is a shortcut for smooth interpolation between two numbers. If value is 0, then start is returned. If value is 1, end is returned. For anything in between, the function interpolates between start and end.

value (float): a number between (and including) 0 and 1
start (float): the starting value to interpolate
end (float): the end value to interpolate
Return value (float): a smooth interpolation between start and end
extern void LM_Beep @ Beep();
extern void LM_Snooze @ Snooze(int32 msec);
extern int32 LM_Round @ Round(real f);
extern real LM_Clamp @ Clamp(real f, real min, real max);
extern real LM_Lerp @ Lerp(real f, real min, real max);
extern real LM_Slerp @ Slerp(real f, real min, real max);
  • Posted in: LM