Function Reference

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Time & Date Functions)
(Bits)
Line 227: Line 227:
 
* [[Core Function BinaryLoad|BinaryLoad( <file>, <flag> )]] -- Create a new binary variable by loading binary data from a file
 
* [[Core Function BinaryLoad|BinaryLoad( <file>, <flag> )]] -- Create a new binary variable by loading binary data from a file
  
===== Pack/Unpack =====
+
===== Binary packer/unpacker =====
 
* [[Core Function Pack|Pack( <format>, <args> )]] -- Pack data into a binary array
 
* [[Core Function Pack|Pack( <format>, <args> )]] -- Pack data into a binary array
 
* [[Core Function Unpack|Unpack( <format>, <data/binary-array>, <flag> )]] -- Unpack data from a binary array
 
* [[Core Function Unpack|Unpack( <format>, <data/binary-array>, <flag> )]] -- Unpack data from a binary array
 +
* [[Core Function PackSingle|PackSingle( <format>, <value> )]] -- Pack a single value into a binary array
 +
* [[Core Function UnpackSingle|UnpackSingle( <format>, <data/binary-array>, <position> )]] -- Unpack a single value from a binary array optionally from a given index
  
 
===== Bit Vector =====
 
===== Bit Vector =====
Line 241: Line 243:
 
* [[Core Function FillBit|FillBit( <binary-array>, <value> )]] -- Set all bits to the value
 
* [[Core Function FillBit|FillBit( <binary-array>, <value> )]] -- Set all bits to the value
  
==== Binary Memory Stream Management Functions ====
+
===== BinHex 5.0 =====
* [[Core Function StreamCreate|StreamCreate( )]] -- Create a new binary stream
+
* [[Core Function BinHexEncode|BinHexEncode( <name>, <type>, <creator>, <resourceFork>, <dataFork>, <flag1>, <flag2> )]] -- Encode data (usually a file) to BinHex 5.0 format
* [[Core Function StreamCreateB|StreamCreateB( <binary-stream>, <binary-array> )]] -- Create a new binary stream from a binary variable
+
* [[Core Function BinHexDecode|BinHexDecode( <binhex-binary> )]] -- Decode data (usually a file) from BinHex 5.0 format
* [[Core Function StreamLen|StreamLen( <binary-stream> )]] -- Get the length of a binary stream
+
 
* [[Core Function StreamSetLen|StreamSetLen( <binary-stream>, <length> )]] -- Set the length of a binary stream
+
===== ByteBuffer =====
* [[Core Function StreamPos|StreamPos( <binary-stream> )]] -- Get the current seek position of a binary stream
+
The ByteBuffer is the replacement for the old Stream functions it is more robust, has more features and is resistant to crashes/errors from bad information etc it works similar to the ByteBuffer in Java
* [[Core Function StreamSeek|StreamSeek( <binary-stream>, <pos> )]] -- Set the seek position of a binary stream
+
* [[Core Function ByteBufferNew|ByteBufferNew( <nothing/binary/byteBuffer> )]] -- Make a new ByteBuffer
* [[Core Function StreamCompare|StreamCompare( <binary-stream>, <binary-stream2> )]] -- Compare two binary streams to see if they are identical in data content
+
* [[Core Function ByteBufferGet|ByteBufferGet( <byteBuffer>, <type>, <index> )]] -- Get data from a ByteBuffer
* [[Core Function StreamRead|StreamRead( <binary-stream>, <count> )]] -- Read a number of bytes from a binary stream
+
* [[Core Function ByteBufferPut|ByteBufferPut( <byteBuffer>, <type>, <variable> )]] -- Add data to a ByteBuffer
* [[Core Function StreamReadByte|StreamReadByte( <binary-stream> )]] -- Read a single byte from a binary stream
+
* [[Core Function ByteBufferPeek|ByteBufferPeek( <byteBuffer>, <type> )]] -- Peek at data from a ByteBuffer (same as get but without moving the position forward)
* [[Core Function StreamReadUnpack|StreamReadUnpack( <binary-stream>, <count>, <def>, <unpack-flag> )]] -- Read from a binary stream the same way Unpack() is used
+
* [[Core Function ByteBufferGetBinary|ByteBufferGetBinary( <byteBuffer>, <offset>, <length> )]] -- Get all the binary data from a ByteBuffer (ignores the position) or get all bytes starting from offset to a given length (or all remaining bytes from that offset)
* [[Core Function StreamWrite|StreamWrite( <binary-stream>, <binary-array> )]] -- Write the bytes from a binary variable to the binary stream
+
* [[Core Function ByteBufferCapacity|ByteBufferCapacity( <byteBuffer> )]] -- Get the current capacity of a ByteBuffer
* [[Core Function StreamWriteByte|StreamWriteByte( <binary-stream>, <binary-array> )]] -- Write a single byte to the binary stream
+
* [[Core Function ByteBufferRewind|ByteBufferRewind( <byteBuffer> )]] -- Set the position of a ByteBuffer back to the start
* [[Core Function StreamWritePack|StreamWritePack( <binary-stream>, <def>, <params> )]] -- Write a data to the binary stream the same way Pack() is used
+
* [[Core Function ByteBufferLimit|ByteBufferLimit( <byteBuffer> )]] -- Get the current capacity/length that can be written (based on its currently allocated size) of a ByteBuffer
* [[Core Function StreamToBinary|StreamToBinary( <binary-stream> )]] -- Return a new binary variable from the data within the binary stream
+
* [[Core Function ByteBufferPosition|ByteBufferPosition( <byteBuffer>, <newPosition> )]] -- Get and set the position of a ByteBuffer to any value
* [[Core Function StreamSave|StreamSave( <binary-stream>, <file>, <flag> )]] -- Save the binary stream to file
+
* [[Core Function ByteBufferRemaining|ByteBufferRemaining( <byteBuffer> )]] -- Get how many bytes are possible to read from current position of a ByteBuffer
* [[Core Function StreamLoad|StreamLoad( <file>, <flag> )]] -- Load a binary stream from file
+
* [[Core Function ByteBufferHasRemaining|ByteBufferHasRemaining( <byteBuffer> )]] -- Check if its possible to read at least one byte from the ByteBuffer
 +
* [[Core Function ByteBufferClear|ByteBufferClear( <byteBuffer> )]] -- Clear all data from a ByteBuffer (reset it back to new) also if the mark is defined then it is discarded
 +
* [[Core Function ByteBufferFlip|ByteBufferFlip( <byteBuffer> )]] -- Flip a ByteBuffer it flips this buffer then the limit is set to the current position and then the position is set to zero also if the mark is defined then it is discarded
 +
* [[Core Function ByteBufferMark|ByteBufferMark( <byteBuffer> )]] -- Mark the position in a ByteBuffer
 +
* [[Core Function ByteBufferReset|ByteBufferReset( <byteBuffer> )]] -- Reset the position to the previously marked position in a ByteBuffer
 +
* [[Core Function ByteBufferCompare|ByteBufferCompare( <byteBuffer>, <byteBuffer> )]] -- Compare two ByteBuffers to see if they are equal
 +
* [[Core Function ByteBufferClone|ByteBufferClone( <byteBuffer> )]] -- Clone a ByteBuffer
 +
 
 +
===== NBT (Named Binary Tag) =====
 +
Functions on par with Minecrafts NBT system but greatly expanded to include many additional features and improvements specific for Sputnik.
 +
* [[Core Function NBT|NBT( <value> )]] -- Convert a variable into an accurate NBT representation of it
 +
* [[Core Function NBTNew|NBTNew( <nbt-type>, <key>, <value> )]] -- Create a new NBT of a given type and optionally give it a name and starting value
 +
* [[Core Function NBTCompare|NBTCompare( <nbt>, <nbt> )]] -- Compare two NBT variables to see if they contain the same data
 +
* [[Core Function NBTCopy|NBTCopy( <nbt> )]] -- Make a clone of an NBT
 +
* [[Core Function NBTGetId|NBTGetId( <nbt> )]] -- Get the ID type of an NBT
 +
* [[Core Function NBTGetName|NBTGetName( <nbt> )]] -- Get the name (tag key) of an NBT
 +
* [[Core Function NBTSetName|NBTGetName( <nbt>, <new-name> )]] -- Set the name (tag key) of an NBT
 +
* [[Core Function NBTHash|NBTHash( <nbt> )]] -- Compute the CRC32 hash of an NBT
 +
* [[Core Function NBTToString|NBTToString( <nbt> )]] -- Return a string representation of an NBT
 +
* [[Core Function NBTToVar|NBTToVar( <nbt> )]] -- Return the Sputnik variable representation of an NBT
 +
* [[Core Function IsVarNBT|IsVarNBT( <value> )]] -- Check if a variable is contains an NBT
 +
 
 +
====== NBTTagCompound ======
 +
* [[Core Function NBTCompoundClear|NBTCompoundClear( <nbtCompound> )]] -- Clear all tags
 +
* [[Core Function NBTCompoundCount|NBTCompoundCount( <nbtCompound> )]] -- Return the amount of tags
 +
* [[Core Function NBTCompoundGet|NBTCompoundGet( <nbtCompound>, <tag> )]] -- Get a tag by name
 +
* [[Core Function NBTCompoundSet|NBTCompoundSet( <nbtCompound>, <tag>, <value> )]] -- Set a tag by name
 +
* [[Core Function NBTCompoundGetKeys|NBTCompoundGetKeys( <nbtCompound> )]] -- Get an array of all keys
 +
* [[Core Function NBTCompoundGetTags|NBTCompoundGetTags( <nbtCompound> )]] -- Get an array of all tags
 +
* [[Core Function NBTCompoundGetMap|NBTCompoundGetMap( <nbtCompound> )]] -- Get an associative array of all keys and tags
 +
* [[Core Function NBTCompoundHasKey|NBTCompoundHasKey( <nbtCompound>, <tag> )]] -- Check if a given tag exists by name
 +
* [[Core Function NBTCompoundIsEmpty|NBTCompoundIsEmpty( <nbtCompound> )]] -- Check if there are no tags
 +
* [[Core Function NBTCompoundRemove|NBTCompoundRemove( <nbtCompound>, <tag>, <value> )]] -- Remove a specific tag by name
 +
* [[Core Function NBTCompoundWrite|NBTCompoundWrite( <nbtCompound>, <buffer> )]] -- Write the NBTTagCompound to binary or a buffer
 +
* [[Core Function NBTCompoundRead|NBTCompoundRead( <binary-variable/buffer> )]] -- Create a new NBTTagCompound from a binary array or a buffer
 +
* [[Core Function NBTCompoundWriteFile|NBTCompoundWriteFile( <nbtCompound>, <file>, <compression )]] -- Write the NBTTagCompound to a file
 +
* [[Core Function NBTCompoundReadFile|NBTCompoundReadFile( <file> )]] -- Create a new NBTTagCompound from reading a file
 +
* [[Core Function NBTCompoundCompress|NBTCompoundCompress( <nbtCompound> )]] -- Compress the NBTTagCompound to binary
 +
* [[Core Function NBTCompoundDecompress|NBTCompoundDecompress( <binary-variable> )]] -- Decompress a NBTTagCompound from binary
 +
* [[Core Function NBTCompoundWriteCompressed|NBTCompoundWriteCompressed( <nbtCompound>, <buffer> )]] -- Compress the NBTTagCompound and write it to a buffer
 +
* [[Core Function NBTCompoundReadCompressed|NBTCompoundReadCompressed( <buffer> )]] -- Decompress a NBTTagCompound from a buffer
 +
 
 +
====== NBTTagList/NBTTagListEx ======
 +
* [[Core Function NBTListAppend|NBTListAppend( <nbtList>, <value> )]] -- Add an NBT to the end of the list
 +
* [[Core Function NBTListCount|NBTListCount( <nbtList> )]] -- Return how many tags exist in the list
 +
* [[Core Function NBTListGet|NBTListGet( <nbtList>, <index> )]] -- Get a tag at the given index
 +
* [[Core Function NBTListHasId|NBTListHasId( <nbtList>, <index> )]] -- Check if an index is valid and contains a tag
 +
* [[Core Function NBTListRemove|NBTListRemove( <nbtList>, <index> )]] -- Remove the tag at the given index
  
 
==== Math Functions ====
 
==== Math Functions ====
Line 385: Line 434:
 
* [[Core Function HTMLSpecialChars|HTMLSpecialChars( <string>, <flags>, <encoding>, <double_encode> )]] -- Convert special characters to HTML entities
 
* [[Core Function HTMLSpecialChars|HTMLSpecialChars( <string>, <flags>, <encoding>, <double_encode> )]] -- Convert special characters to HTML entities
 
* [[Core Function HTMLSpecialCharsDecode|HTMLSpecialCharsDecode( <string>, <flags> )]] -- Convert special HTML entities back to characters  
 
* [[Core Function HTMLSpecialCharsDecode|HTMLSpecialCharsDecode( <string>, <flags> )]] -- Convert special HTML entities back to characters  
 +
* [[Core Function HTTPMakeQuery|HTTPMakeQuery( <array> )]] -- Converts an array into a properly formatted HTTP query string for use with requests etc
 +
* [[Core Function HTTPParseQuery|HTTPParseQuery( <string> )]] -- Parse an HTTP query string into an array
 
* [[Core Function Fmt|Fmt( <format control>, <params> )]] -- Create a formatted string
 
* [[Core Function Fmt|Fmt( <format control>, <params> )]] -- Create a formatted string
 
* [[Core Function FmtNumber|FmtNumber( <number>, <decimals>, <dec_point>, <thousands_sep> )]] -- Format a number with grouped thousands
 
* [[Core Function FmtNumber|FmtNumber( <number>, <decimals>, <dec_point>, <thousands_sep> )]] -- Format a number with grouped thousands
Line 507: Line 558:
  
 
==== Array Functions ====
 
==== Array Functions ====
 +
* [[Core Function SameValues|SameValues( <array> )]] -- Check if all values within an array are the same value type such as all String and return the type or return error type
 
* [[Core Function ArrayScope|ArrayScope( <array>, <scope> )]] -- Get or Set an arrays internal Sputnik scope (Only to be used by Sputnik library developers)
 
* [[Core Function ArrayScope|ArrayScope( <array>, <scope> )]] -- Get or Set an arrays internal Sputnik scope (Only to be used by Sputnik library developers)
 
* [[Core Function IsHash|IsHash( <array> )]] -- Check if all the keys in an array are Strings rather than numeric (Making it a full hashmap rather than full array or mixed)
 
* [[Core Function IsHash|IsHash( <array> )]] -- Check if all the keys in an array are Strings rather than numeric (Making it a full hashmap rather than full array or mixed)
Line 693: Line 745:
 
* [[Core Function SSListen|SSListen( <port>, <max connections>, <name>  )]] -- Create a server and begin listening for clients to connect
 
* [[Core Function SSListen|SSListen( <port>, <max connections>, <name>  )]] -- Create a server and begin listening for clients to connect
 
* [[Core Function SSConnect|SSConnect( <ip>, <port>, <connection string>, <name>  )]] -- Connect to a server
 
* [[Core Function SSConnect|SSConnect( <ip>, <port>, <connection string>, <name>  )]] -- Connect to a server
* [[Core Function SSApprove|SSApprove( <server>, <client socket> )]] -- Approve a client to connect to the server
+
* [[Core Function SSApprove|SSApprove( <client socket> )]] -- Approve a client to connect to the server
* [[Core Function SSDisapprove|SSDisapprove( <server>, <client socket> )]] -- Disapprove a client to connect to the server
+
* [[Core Function SSDisapprove|SSDisapprove( <client socket> )]] -- Disapprove a client to connect to the server
 
* [[Core Function SSClientStatus|SSClientStatus( /* depends... /* )]] -- Get the status of a client or of our client
 
* [[Core Function SSClientStatus|SSClientStatus( /* depends... /* )]] -- Get the status of a client or of our client
* [[Core Function SSClientIP|SSClientIP( <server>, <client socket> )]] -- Get the IP of a client socket
+
* [[Core Function SSClientIP|SSClientIP( <client socket> )]] -- Get the IP of a client socket
 
* [[Core Function SSRecv|SSRecv( <server/client> )]] -- Check for a message recieved from client/server
 
* [[Core Function SSRecv|SSRecv( <server/client> )]] -- Check for a message recieved from client/server
* [[Core Function SSRead|SSRead( <message buffer>, <data type> )]] -- Read data from a message
+
* [[Core Function SSRead|SSRead( <server/client>, <data type> )]] -- Read data from a the socket
* [[Core Function SSDrop|SSDrop( <server>, <client socket> )]] -- Kick a client off the server
+
* [[Core Function SSDrop|SSDrop( <client socket>, <reason> )]] -- Kick a client off the server
* [[Core Function SSSendBufferCreate|SSSendBufferCreate( <server/client> )]] -- Create a new buffer to store data to send to the client/server
+
* [[Core Function SSSendBufferAppend|SSSendBufferAppend( <message buffer>, <type>, <data> )]] -- Add data to the buffer to send such as Strings etc
+
 
* [[Core Function SSSend|SSSend( /* depends... /* )]] -- Send data to client or server
 
* [[Core Function SSSend|SSSend( /* depends... /* )]] -- Send data to client or server
 +
* [[Core Function SSBufferNew|SSBufferNew( <nothing/server/client> )]] -- Create a new net buffer to store data to send to the client/server
 +
* [[Core Function SSBufferPut|SSBufferPut( <netBuffer>, <type>, <data> )]] -- Add data to the buffer to send such as Strings etc
  
 
===== Raw Sockets (TCP/UDP etc) =====
 
===== Raw Sockets (TCP/UDP etc) =====

Revision as of 12:19, 14 June 2015

Contents

Function Reference

How to create a Function

To create your own funtions see the Function page.

Core Functions

If a link is red (unclickable) the function either doesnt exist yet and is pending creation or it has been created but does not yet have a page/example.

Language Features

Parser Engine

Console Functions

Multi-Threading Functions

Variable Type Conversions

Common Variable Functions

Misc
Type Checking
Get Type Directly

Binary Data Management Functions

Binary packer/unpacker
Bit Vector
Bits
BinHex 5.0
ByteBuffer

The ByteBuffer is the replacement for the old Stream functions it is more robust, has more features and is resistant to crashes/errors from bad information etc it works similar to the ByteBuffer in Java

NBT (Named Binary Tag)

Functions on par with Minecrafts NBT system but greatly expanded to include many additional features and improvements specific for Sputnik.

NBTTagCompound
NBTTagList/NBTTagListEx

Math Functions

String Functions

CharPtr Functions

Note the Fixed statement is tied directly with CharPtr

Array Functions

Linq (Integrated Language Query) Functions

Enum Functions

Process Functions

Environment Management

File Functions

File Create/Read/Write Functions
Misc
Dialogs

Directory Functions

Dialogs

Path Functions

Network Functions

HTTP Functions
MySQL Functions
Sputnik Client/Server Functions (This is just for connecting Sputnik Clients to Sputnik Servers nothing else)
Raw Sockets (TCP/UDP etc)
Misc Network Functions

Memory Functions

Clipboard Functions

Registry Functions

Time & Date Functions

GUI Functions

Dialog Creation Functions
Control Creation Functions
NOT AVAILABLE YET
Window/Control Properties Get/Set Functions

Note - Any options not here are most likely found using GUIGetProp and GUISetProp the bulk of all props can be found/used in them 2 funtions however anything special and not generic will go in the functions below.

Common Dialog/Control Properties Get/Set Functions
Common Dialog/Control Functions
GUI Link (Event) Functions
Other GUI Functions

Bitmap Functions

Keyboard Control Functions

Mouse Control Functions

Window Management Functions

(For info on using <title>, <text> See Window Titles and Text (Advanced) )

Controls

(For info on using <title>, <text> See Window Titles and Text (Advanced) )

NOT AVAILABLE YET

Graphics/Pixel Functions

.NET Functions and Features

Control Flow Functions

  • Return <expressions> -- Immediately ends execution of the current function, and returns its argument as the value of the function call. return will also end the execution of an Eval() statement or script file
  • Throw( <expression> ) -- Throw an exception
  • Die( <expression> ) -- Gives an error and terminates the program
  • Break( <scopes> ) -- Ends execution of the current loop
  • Continue( <scopes> ) -- Continue the execution of a loop at its next iteration
  • Redo( ) -- Continue the execution of a loop at the start of the current iteration

Misc Functions

User Defined Functions

These functions are created using Sputnik and are not part of the Sputnik core language.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox