void log(? value)
Logs a value to the console. The value can be of any type. This includes strings, simple types and native objects.
If a native object is passed, the data will be serialized and logged as a string.
To log the contents of a pointer, use
log(pointer) to dereference the pointer to a value.
If you need to log the address of a pointer, use
log also supports logging character pointers, which e.g allows to log
void success(? value)
The same as log, but the value will be logged with green color.
void warn(? value)
The same as log, but the value will be logged with yellow color.
void error(? value)
The same as log, but the value will be logged with red color.
void print(? value)
The same as log, but the value will be printed out to stdout (if the console is allocated).
void assert(const bool condition)
assert throws a script exception if the passed
condition is false. Otherwise, does nothing.
The exception will be logged to the console together with the filename and line number.
Currently, the program continues to run after the exception is thrown.
Calls the Windows GetCurrentThreadId API and returns the result. This is the thread that executes the snippet.
void sleep(uint32 milliseconds)
Calls the Windows Sleep API and waits until the time-out interval elapses.
 void view()  void view(? value, int sort = -1)  void view(? value, const string& name, int sort = -1)
 view()views all available objects within the context of the snippet. This includes all native local function variables and parameters. Calling the function copies the data to a buffer that is then sent to the D0 client UI. This means that the object state is updated only when
view()does not stop the execution, which requires D0 to omit data referenced by pointers in the objects that are viewed. Data from pointers is transferred only when the user expands the pointer object in the UI, this expansion requires that
view()is called again, so that D0 can copy the data. When a user changes a value of the object in D0, this change is applied in the next call to
It is currently not possible to configure manually what data should be transferred when viewing pointers.
D0 determines which object to update by the filename and line number the call is placed on. If the call is in a for loop and you want to view different objects from the same line, you can use the
nameparameter in the
 view()overload to differentiate between them.
Two other overloads are available:
Takes the object to view and an additional optional
 view(), only the object that was passed is viewed. You can additionally pass a positive integer to determine in which position the object should be viewed in the UI. This is useful when viewing multiple objects e.g in an ordered list.
- Same as 2, but allows to specify the name of the object that is displayed in the UI. If the name is specified, it will be used to identify which object to update, instead of the filename and line number.
 void list(ptr<?>& value, int count = -1, const string& name = "")  void list(ptr<?>& value, const string& name = "")
list() may be used to view a list of objects given a pointer to the first element of the list.
The type and size of an element is determined by the inner type of the pointer.
ptr<char> is passed, the list will be viewed as a string. In this case,
count is not specified, the length of the string will be determined by calling
strlen on the pointer. If the value is not a character pointer and
count is not specified, a list of length 1 will be assumed.
If a name is specified, it will be displayed in the UI along with the element index instead of the default
Clears all the messages from the Logs window.
void enableLog(const bool enabled)
Enables or disables the logging of messages to the Logs window.
 string hex(int64 value)  string hex(uint64 value)
Converts the passed value to a hexadecimal string.
0x prefix is not included.
For negative values, the
 hex() overload is used and
- is prepended to the result.
 string bin(int64 value)  string bin(uint64 value)
Converts the passed value to a binary representation string.
0b prefix is not included.
For negative values, the
 bin() overload is used and
- is prepended to the result.
uint64 allocate(uint64 size)
freewhen you are done with it.
To cast the returned address to a pointer of a specific type:
ptr<Type> p; p.address = allocate(100);
bool free(uint64 block)
false in case a snippet tries to free a 64bit address when running in a 32bit process.
bool memset(uint64 destination, uint8 value, uint64 size)
sizebytes of the memory block pointed to by
destinationto the specified
false in case a snippet tries to set a 64bit address when running in a 32bit process.
bool memcpy(uint64 destination, uint64 source, uint64 size)
sizebytes from the memory block pointed to by
sourceto the memory block pointed to by
false in case a snippet tries to copy from a 64bit address when running in a 32bit process.
Returns the time in milliseconds using QueryPerformanceCounter.
uint8 popcount(uint64 value)
Returns the number of bits set to 1 in the passed value.
 float min(float a, float b)  double min(float a, double b)  int64 min(int64 a, int64 b)  uint64 min(uint64 a, uint64 b)
Returns the minimum of the two passed values.
 float max(float a, float b)  double max(float a, double b)  int64 max(int64 a, int64 b)  uint64 max(uint64 a, uint64 b)
Returns the maximum of the two passed values.
 float clamp(float value, float min, float max)  double clamp(double value, double min, double max)  int64 clamp(int64 value, int64 min, int64 max)  uint64 clamp(uint64 value, uint64 min, uint64 max)
Returns the passed value clamped to the specified range.
float sin(float a)
float cos(float a)
float tan(float a)