→ index of project core

Module core

Synopsis: The core TkScript API.

Functions

Classes


Description:
 

This is a set of classes and functions that are built into the TkScript engine.
Some of the classes are also available (as a stripped-down version) in the YAC plugin API.
Function ceil
Round to next bigger integer
Signature
ceil(floatf)
 :float
Arguments
floatf–
Returns
float–

 
→ top of page
Function exit
Exit with the given return code
Signature
exit(intreturn)
Arguments
intreturn–

 
→ top of page
Function floor
Round to next smaller integer
Signature
floor(floatf)
 :float
Arguments
floatf–
Returns
float–

 
→ top of page
Function GetCurrentThread
Query current thread object
Signature
GetCurrentThread():Thread
Returns
Thread–Current Thread object
Description

TkScript must have been compiled with thread local storage support (HAVE_TLS) or this function will always return null.

See also:  


 
→ top of page
Function getenv
Get environment variable
Signature
getenv(Stringname)
 :String
Arguments
Stringname–
Returns
String–
Description

This is a wrapper for the getenv() native function.

 
→ top of page
Function lcchar
Convert character to lower case
Signature
lcchar(charc)
 :char
Arguments
charc–
Returns
char–

 
→ top of page
Function mathAbsMaxf
Return the bigger absolute float value
Signature
mathAbsMaxf(floatx,
  floaty 
  )  
 :float
Arguments
floatx–
floaty–
Returns
float–

 
→ top of page
Function mathAbsMinf
Return the smaller absolute float value
Signature
mathAbsMinf(floatx,
  floaty 
  )  
 :float
Arguments
floatx–
floaty–
Returns
float–

 
→ top of page
Function mathAbsMini
Return the bigger absolute integer value
Signature
mathAbsMini(intx,
  inty 
  )  
 :int
Arguments
intx–
inty–
Returns
int–

 
→ top of page
Function mathAbsMini
Return the smaller absolute integer value
Signature
mathAbsMini(intx,
  inty 
  )  
 :int
Arguments
intx–
inty–
Returns
int–

 
→ top of page
Function mathCerpf
Return cosine interpolation of values a and b according to t (0..1)
Signature
mathCerpf(floata,
  floatb,
  floatt 
  )  
 :float
Arguments
floata–
floatb–
floatt–
Returns
float–

 
→ top of page
Function mathClampf
Clamp value to min/max range
Signature
mathClampf(floata,
  floatb,
  floatc 
  )  
 :float
Arguments
floata–
floatb–
floatc–
Returns
float–

 
→ top of page
Function mathClampi
Clamp value to min/max range
Signature
mathClampi(inta,
  intb,
  intc 
  )  
 :int
Arguments
inta–
intb–
intc–
Returns
int–

 
→ top of page
Function mathDistancePointPlane2d
Return distance of point p to infinite plane.
Signature
mathDistancePointPlane2d(floatpx,
  floatpy,
  floatqx,
  floatqy,
  floatnx,
  floatny 
  )  
 :float
Arguments
floatpx–a point
floatpy–a point
floatqx–a point on the plane
floatqy–a point on the plane
floatnx–the plane normal
floatny–the plane normal
Returns
float–distance of point to plane
Description

 
q is a point on the plane and n is the plane normal.

 
→ top of page
Function mathF16FromF32
Convert 32 to 16 bit floating point value
Signature
mathF16FromF32(floatf)
 :int
Arguments
floatf–
Returns
int–

 
→ top of page
Function mathF32FromF16
Convert 16 to 32 bit floating point value
Signature
mathF32FromF16(intf16)
 :float
Arguments
intf16–
Returns
float–

 
→ top of page
Function mathFoldf
Fold value into min/max range
Signature
mathFoldf(floata,
  floatb,
  floatt 
  )  
 :float
Arguments
floata–
floatb–
floatt–
Returns
float–

 
→ top of page
Function mathFoldi
Fold value into min/max range
Signature
mathFoldi(inta,
  intb,
  intt 
  )  
 :int
Arguments
inta–
intb–
intt–
Returns
int–

 
→ top of page
Function mathGCD
Return greatest common divisor via Euclidean algorithm
Signature
mathGCD(intx,
  inty 
  )  
 :int
Arguments
intx–
inty–
Returns
int–

 
→ top of page
Function mathLerpCyclicf
Cyclic interpolation
Signature
mathLerpCyclicf(floatx,
  floaty,
  floatc,
  floatt 
  )  
 :float
Arguments
floatx–
floaty–
floatc–Cycle interval (e.g. 2PI or 360)
floatt–
Returns
float–interpolated value

 
→ top of page
Function mathLerpf
Return linear interpolation of values a and b according to t (0..1) (a + (b-a)*t)
Signature
mathLerpf(floata,
  floatb,
  floatt 
  )  
 :float
Arguments
floata–
floatb–
floatt–
Returns
float–

 
→ top of page
Function mathMaxf
Return bigger value
Signature
mathMaxf(floatx,
  floaty 
  )  
 :float
Arguments
floatx–
floaty–
Returns
float–

 
→ top of page
Function mathMaxi
Return bigger value
Signature
mathMaxi(intx,
  inty 
  )  
 :int
Arguments
intx–
inty–
Returns
int–

 
→ top of page
Function mathMinf
Return smaller value
Signature
mathMinf(floatx,
  floaty 
  )  
 :float
Arguments
floatx–
floaty–
Returns
float–

 
→ top of page
Function mathMini
Return smaller value
Signature
mathMini(intx,
  inty 
  )  
 :int
Arguments
intx–
inty–
Returns
int–

 
→ top of page
Function mathNextCyclicf
Return next 'n' (shortest distance between last 'c' and next 'n' with cyclic period = 'cycle', e.g. 360.0 or "PI)
Signature
mathNextCyclicf(floatc,
  floatn,
  floatcycle 
  )  
 :float
Arguments
floatc–current value
floatn–next value
floatcycle–Period len, e.g. 360.0 or 2PI
Returns
float–

 
→ top of page
Function mathPowerf
Return x raised to the power of y.
Signature
mathPowerf(floatx,
  floaty 
  )  
 :float
Arguments
floatx–
floaty–
Returns
float–
Description

This is different to pow() in regard to negative 'x': mathPowerf() returns (sign(x) * pow(abs(x), y)).

 
→ top of page
Function mathPowerfC
Return x raised to the power of y (pow())
Signature
mathPowerfC(floatx,
  floaty 
  )  
 :float
Arguments
floatx–
floaty–
Returns
float–

 
→ top of page
Function mathPoweri
Return x raised to the power of y
Signature
mathPoweri(intx,
  inty 
  )  
 :int
Arguments
intx–
inty–
Returns
int–

 
→ top of page
Function mathSerpf
Return sine interpolation of values a and b according to t (0..1)
Signature
mathSerpf(floata,
  floatb,
  floatt 
  )  
 :float
Arguments
floata–
floatb–
floatt–
Returns
float–

 
→ top of page
Function mathSigmoidf
The standard logistic function (sigmoid) squashes the input parameter to the range 0..1.
Signature
mathSigmoidf(floatx y)
 :float
Arguments
floatx y–
Returns
float–Value in the range 0..1
Description
As x approaches negative infinity, the return value approaches 0.As x approaches positive infinity, the return value approaches 1.

 
→ top of page
Function mathSmoothStepf
Return smooth-step interpolation of values a and b according to s (0..1) (a*(1-t)+b*t, with t=(s*s*(3-2*s)) )
Signature
mathSmoothStepf(floata,
  floatb,
  floats 
  )  
 :float
Arguments
floata–
floatb–
floats–
Returns
float–

 
→ top of page
Function mathSmoothStepNf
Return (higher-order) smooth-step interpolation of values a and b. n must be in the range (0..6).
Signature
mathSmoothStepNf(floata,
  floatb,
  floats,
  intn 
  )  
 :float
Arguments
floata–
floatb–
floats–
intn–
Returns
float–

 
→ top of page
Function mathWrapf
Wrap value around min/max range
Signature
mathWrapf(floata,
  floatb,
  floatt 
  )  
 :float
Arguments
floata–
floatb–
floatt–
Returns
float–

 
→ top of page
Function mathWrapi
Wrap value around min/max range
Signature
mathWrapi(inta,
  intb,
  intt 
  )  
 :int
Arguments
inta–
intb–
intt–
Returns
int–

 
→ top of page
Function milliSeconds
Return milliseconds since system start
Signature
milliSeconds():int
Returns
int–

 
→ top of page
Function milliSecondsDouble
For profiling purposes only, cannot be used to measure long time spans.
Signature
milliSecondsDouble(Doubled)
Arguments
Doubled–Preallocated Double object that will be used to store the timestamp

 
→ top of page
Function psystem
Invoke system command
Signature
psystem(Stringcmd,
  characcess,
  Stringbuf 
  )  
 :int
Arguments
Stringcmd–Command line
characcess–r to read result to buf, w to read input from buf
Stringbuf–Input resp. output buffer
Returns
int–Number of bytes read resp. written

 
→ top of page
Function putenv
Set environment variable
Signature
putenv(Stringname)
 :String
Arguments
Stringname–
Returns
String–
Description

This is a wrapper for the putenv() native function.

 
→ top of page
Function srand
Set random seed
Signature
srand(intseed)
Arguments
intseed–

 
→ top of page
Function system
Invoke system command
Signature
system(Stringcmd)
Arguments
Stringcmd–Command line

 
→ top of page
Function ucchar
Convert character to upper case
Signature
ucchar(charc)
 :char
Arguments
charc–
Returns
char–

 
→ top of page

Project Modules:core 
Project Classes:Boolean , Buffer , Byte , Class , ClassArray , Condition , Configuration , Double , DummyStream , Envelope , Event , Exception , File , Float , FloatArray , FloatArray128 , FloatArray16 , FloatArray32 , FloatArray64 , FloatArray8 , Function , HashTable , IntArray , IntArray128 , IntArray16 , IntArray32 , IntArray64 , IntArray8 , Integer , LFSR , LFSR_NR , List , ListNode , Long , Mailbox , Mutex , Object , ObjectArray , PakFile , PointerArray , Pool , Process , Script , SharedBuffer , Short , Stack , StdErrStream , StdInStream , StdOutStream , Stream , Stream , String , String128 , String16 , String32 , String64 , String8 , StringArray , StringIterator , Thread , Time , TKS , TreeNode , UnsignedByte , UnsignedInteger , UnsignedLong , UnsignedShort , Value , ValueArray , Variable 
Project Functions:ceil , exit , floor , GetCurrentThread , getenv , lcchar , mathAbsMaxf , mathAbsMinf , mathAbsMini , mathAbsMini , mathCerpf , mathClampf , mathClampi , mathDistancePointPlane2d , mathF16FromF32 , mathF32FromF16 , mathFoldf , mathFoldi , mathGCD , mathLerpCyclicf , mathLerpf , mathMaxf , mathMaxi , mathMinf , mathMini , mathNextCyclicf , mathPowerf , mathPowerfC , mathPoweri , mathSerpf , mathSigmoidf , mathSmoothStepf , mathSmoothStepNf , mathWrapf , mathWrapi , milliSeconds , milliSecondsDouble , psystem , putenv , srand , system , ucchar 
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


 
→ top of page

auto-generated by "DOG", the TkScript document generator. Sun, 4/Oct/2026 11:25:13