Struct byondapi_sys::ByondApi
source · pub struct ByondApi { /* private fields */ }Implementations§
Methods from Deref<Target = ByondApi>§
sourcepub unsafe fn Byond_LastError(&self) -> *const c_char
pub unsafe fn Byond_LastError(&self) -> *const c_char
Gets the last error from a failed call The result is a static string that does not need to be freed.
§Returns
Error message
sourcepub unsafe fn Byond_GetVersion(&self, version: *mut u4c, build: *mut u4c)
pub unsafe fn Byond_GetVersion(&self, version: *mut u4c, build: *mut u4c)
Gets the current BYOND version
§Arguments
version- Pointer to the major version numberbuild- Pointer to the build number
sourcepub unsafe fn Byond_GetDMBVersion(&self) -> u4c
pub unsafe fn Byond_GetDMBVersion(&self) -> u4c
sourcepub unsafe fn ByondValue_Clear(&self, v: *mut CByondValue)
pub unsafe fn ByondValue_Clear(&self, v: *mut CByondValue)
sourcepub unsafe fn ByondValue_Type(&self, v: *const CByondValue) -> ByondValueType
pub unsafe fn ByondValue_Type(&self, v: *const CByondValue) -> ByondValueType
sourcepub unsafe fn ByondValue_IsNull(&self, v: *const CByondValue) -> bool
pub unsafe fn ByondValue_IsNull(&self, v: *const CByondValue) -> bool
sourcepub unsafe fn ByondValue_IsNum(&self, v: *const CByondValue) -> bool
pub unsafe fn ByondValue_IsNum(&self, v: *const CByondValue) -> bool
sourcepub unsafe fn ByondValue_IsStr(&self, v: *const CByondValue) -> bool
pub unsafe fn ByondValue_IsStr(&self, v: *const CByondValue) -> bool
sourcepub unsafe fn ByondValue_IsList(&self, v: *const CByondValue) -> bool
pub unsafe fn ByondValue_IsList(&self, v: *const CByondValue) -> bool
sourcepub unsafe fn ByondValue_IsTrue(&self, v: *const CByondValue) -> bool
pub unsafe fn ByondValue_IsTrue(&self, v: *const CByondValue) -> bool
sourcepub unsafe fn ByondValue_GetNum(&self, v: *const CByondValue) -> f32
pub unsafe fn ByondValue_GetNum(&self, v: *const CByondValue) -> f32
sourcepub unsafe fn ByondValue_GetRef(&self, v: *const CByondValue) -> u4c
pub unsafe fn ByondValue_GetRef(&self, v: *const CByondValue) -> u4c
sourcepub unsafe fn ByondValue_SetNum(&self, v: *mut CByondValue, f: f32)
pub unsafe fn ByondValue_SetNum(&self, v: *mut CByondValue, f: f32)
Fills a CByondValue struct with a floating point number.
§Arguments
v- Pointer to CByondValuef- Floating point number
sourcepub unsafe fn ByondValue_SetStr(&self, v: *mut CByondValue, str_: *const c_char)
pub unsafe fn ByondValue_SetStr(&self, v: *mut CByondValue, str_: *const c_char)
Creates a string and sets CByondValue to a temporary reference to that string. Blocks if not on the main thread. If string creation fails, the struct is set to null.
§Arguments
v- Pointer to CByondValuestr- Null-terminated UTF-8 string [Byond_AddGetStrId()]
sourcepub unsafe fn ByondValue_SetRef(
&self,
v: *mut CByondValue,
type_: ByondValueType,
ref_: u4c,
)
pub unsafe fn ByondValue_SetRef( &self, v: *mut CByondValue, type_: ByondValueType, ref_: u4c, )
Fills a CByondValue struct with a reference (object) type. Does not validate.
§Arguments
v- Pointer to CByondValuetype- 1-byte teference typeref- 4-byte reference ID; for most types, an ID of NONE is invalid [Byond_TestRef()]
sourcepub unsafe fn ByondValue_Equals(
&self,
a: *const CByondValue,
b: *const CByondValue,
) -> bool
pub unsafe fn ByondValue_Equals( &self, a: *const CByondValue, b: *const CByondValue, ) -> bool
sourcepub unsafe fn Byond_ThreadSync(
&self,
callback: ByondCallback,
data: *mut c_void,
block: bool,
) -> CByondValue
pub unsafe fn Byond_ThreadSync( &self, callback: ByondCallback, data: *mut c_void, block: bool, ) -> CByondValue
Runs a function as a callback on the main thread (or right away if already there) Blocking is optional. If already on the main thread, the block parameter is meaningless.
§Arguments
callback- Function pointer to CByondValue function(void*)data- Void pointer (argument to function)block- True if this call should block while waiting for the callback to finish; false if not
§Returns
CByondValue returned by the function (if it blocked; null if not)
sourcepub unsafe fn Byond_GetStrId(&self, str_: *const c_char) -> u4c
pub unsafe fn Byond_GetStrId(&self, str_: *const c_char) -> u4c
sourcepub unsafe fn Byond_AddGetStrId(&self, str_: *const c_char) -> u4c
pub unsafe fn Byond_AddGetStrId(&self, str_: *const c_char) -> u4c
sourcepub unsafe fn Byond_ReadVar(
&self,
loc: *const CByondValue,
varname: *const c_char,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_ReadVar( &self, loc: *const CByondValue, varname: *const c_char, result: *mut CByondValue, ) -> bool
sourcepub unsafe fn Byond_ReadVarByStrId(
&self,
loc: *const CByondValue,
varname: u4c,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_ReadVarByStrId( &self, loc: *const CByondValue, varname: u4c, result: *mut CByondValue, ) -> bool
sourcepub unsafe fn Byond_WriteVar(
&self,
loc: *const CByondValue,
varname: *const c_char,
val: *const CByondValue,
) -> bool
pub unsafe fn Byond_WriteVar( &self, loc: *const CByondValue, varname: *const c_char, val: *const CByondValue, ) -> bool
sourcepub unsafe fn Byond_WriteVarByStrId(
&self,
loc: *const CByondValue,
varname: u4c,
val: *const CByondValue,
) -> bool
pub unsafe fn Byond_WriteVarByStrId( &self, loc: *const CByondValue, varname: u4c, val: *const CByondValue, ) -> bool
sourcepub unsafe fn Byond_CreateList(&self, result: *mut CByondValue) -> bool
pub unsafe fn Byond_CreateList(&self, result: *mut CByondValue) -> bool
sourcepub unsafe fn Byond_ReadList(
&self,
loc: *const CByondValue,
list: *mut CByondValue,
len: *mut u4c,
) -> bool
pub unsafe fn Byond_ReadList( &self, loc: *const CByondValue, list: *mut CByondValue, len: *mut u4c, ) -> bool
Reads items from a list. Blocks if not on the main thread.
§Arguments
loc- The list to readlist- CByondValue array, allocated by caller (can be null if querying length)len- Pointer to length of array (in items); receives the number of items read on success, or required length of array if not big enough
§Returns
True on success; false with *len=0 for failure; false with *len=required size if array is not big enough
sourcepub unsafe fn Byond_WriteList(
&self,
loc: *const CByondValue,
list: *const CByondValue,
len: u4c,
) -> bool
pub unsafe fn Byond_WriteList( &self, loc: *const CByondValue, list: *const CByondValue, len: u4c, ) -> bool
sourcepub unsafe fn Byond_ReadListAssoc(
&self,
loc: *const CByondValue,
list: *mut CByondValue,
len: *mut u4c,
) -> bool
pub unsafe fn Byond_ReadListAssoc( &self, loc: *const CByondValue, list: *mut CByondValue, len: *mut u4c, ) -> bool
Reads items as key,value pairs from an associative list, storing them sequentially as key1, value1, key2, value2, etc. Blocks if not on the main thread.
§Arguments
loc- The list to readlist- CByondValue array, allocated by caller (can be null if querying length)len- Pointer to length of array (in items); receives the number of items read on success, or required length of array if not big enough
§Returns
True on success; false with *len=0 for failure; false with *len=required size if array is not big enough
sourcepub unsafe fn Byond_ReadListIndex(
&self,
loc: *const CByondValue,
idx: *const CByondValue,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_ReadListIndex( &self, loc: *const CByondValue, idx: *const CByondValue, result: *mut CByondValue, ) -> bool
sourcepub unsafe fn Byond_WriteListIndex(
&self,
loc: *const CByondValue,
idx: *const CByondValue,
val: *const CByondValue,
) -> bool
pub unsafe fn Byond_WriteListIndex( &self, loc: *const CByondValue, idx: *const CByondValue, val: *const CByondValue, ) -> bool
sourcepub unsafe fn Byond_ReadPointer(
&self,
ptr: *const CByondValue,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_ReadPointer( &self, ptr: *const CByondValue, result: *mut CByondValue, ) -> bool
sourcepub unsafe fn Byond_WritePointer(
&self,
ptr: *const CByondValue,
val: *const CByondValue,
) -> bool
pub unsafe fn Byond_WritePointer( &self, ptr: *const CByondValue, val: *const CByondValue, ) -> bool
sourcepub unsafe fn Byond_CallProc(
&self,
src: *const CByondValue,
name: *const c_char,
arg: *const CByondValue,
arg_count: u4c,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_CallProc( &self, src: *const CByondValue, name: *const c_char, arg: *const CByondValue, arg_count: u4c, result: *mut CByondValue, ) -> bool
Calls an object proc by name. The proc call is treated as waitfor=0 and will return immediately on sleep. Blocks if not on the main thread.
§Arguments
src- The object that owns the procname- Proc name as null-terminated stringarg- Array of argumentsarg_count- Number of argumentsresult- Pointer to accept result
§Returns
True on success
sourcepub unsafe fn Byond_CallProcByStrId(
&self,
src: *const CByondValue,
name: u4c,
arg: *const CByondValue,
arg_count: u4c,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_CallProcByStrId( &self, src: *const CByondValue, name: u4c, arg: *const CByondValue, arg_count: u4c, result: *mut CByondValue, ) -> bool
Calls an object proc by name, where the name is a string ID. The proc call is treated as waitfor=0 and will return immediately on sleep. Blocks if not on the main thread.
§Arguments
src- The object that owns the procname- Proc name as string IDarg- Array of argumentsarg_count- Number of argumentsresult- Pointer to accept result
§Returns
True on success
[Byond_GetStrId()]
sourcepub unsafe fn Byond_CallGlobalProc(
&self,
name: *const c_char,
arg: *const CByondValue,
arg_count: u4c,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_CallGlobalProc( &self, name: *const c_char, arg: *const CByondValue, arg_count: u4c, result: *mut CByondValue, ) -> bool
Calls a global proc by name. The proc call is treated as waitfor=0 and will return immediately on sleep. Blocks if not on the main thread.
§Arguments
name- Proc name as null-terminated stringarg- Array of argumentsarg_count- Number of argumentsresult- Pointer to accept result
§Returns
True on success
sourcepub unsafe fn Byond_CallGlobalProcByStrId(
&self,
name: u4c,
arg: *const CByondValue,
arg_count: u4c,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_CallGlobalProcByStrId( &self, name: u4c, arg: *const CByondValue, arg_count: u4c, result: *mut CByondValue, ) -> bool
Calls a global proc by name, where the name is a string ID. The proc call is treated as waitfor=0 and will return immediately on sleep. Blocks if not on the main thread.
§Arguments
name- Proc name as string IDarg- Array of argumentsarg_count- Number of argumentsresult- Pointer to accept result
§Returns
True on success
[Byond_GetStrId()]
sourcepub unsafe fn Byond_ToString(
&self,
src: *const CByondValue,
buf: *mut c_char,
buflen: *mut u4c,
) -> bool
pub unsafe fn Byond_ToString( &self, src: *const CByondValue, buf: *mut c_char, buflen: *mut u4c, ) -> bool
Uses BYOND’s internals to represent a value as text Blocks if not on the main thread.
§Arguments
src- The value to convert to textbuf- char array, allocated by caller (can be null if querying length)buflen- Pointer to length of array in bytes; receives the string length (including trailing null) on success, or required length of array if not big enough
§Returns
True on success; false with *buflen=0 for failure; false with *buflen=required size if array is not big enough
sourcepub unsafe fn Byond_Block(
&self,
corner1: *const CByondXYZ,
corner2: *const CByondXYZ,
list: *mut CByondValue,
len: *mut u4c,
) -> bool
pub unsafe fn Byond_Block( &self, corner1: *const CByondXYZ, corner2: *const CByondXYZ, list: *mut CByondValue, len: *mut u4c, ) -> bool
Equivalent to calling block(x1,y1,z1, x2,y2,z2). Blocks if not on the main thread.
§Arguments
corner1- One corner of the blockcorner2- Another corner of the blocklist- CByondValue array, allocated by caller (can be null if querying length)len- Pointer to length of array (in items); receives the number of items read on success, or required length of array if not big enough
§Returns
True on success; false with *len=0 for failure; false with *len=required size if array is not big enough
sourcepub unsafe fn Byond_Length(
&self,
src: *const CByondValue,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_Length( &self, src: *const CByondValue, result: *mut CByondValue, ) -> bool
sourcepub unsafe fn Byond_LocateIn(
&self,
type_: *const CByondValue,
list: *const CByondValue,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_LocateIn( &self, type_: *const CByondValue, list: *const CByondValue, result: *mut CByondValue, ) -> bool
Equivalent to calling locate(type), or locate(type) in list. Blocks if not on the main thread.
§Arguments
type- The type to locatelist- The list to locate in; can be a null pointer instead of a CByondValue to locate(type) without a listresult- Pointer to accept result; can be null if nothing is found
§Returns
True on success (including if nothing is found); false on error
sourcepub unsafe fn Byond_LocateXYZ(
&self,
xyz: *const CByondXYZ,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_LocateXYZ( &self, xyz: *const CByondXYZ, result: *mut CByondValue, ) -> bool
sourcepub unsafe fn Byond_New(
&self,
type_: *const CByondValue,
arg: *const CByondValue,
arg_count: u4c,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_New( &self, type_: *const CByondValue, arg: *const CByondValue, arg_count: u4c, result: *mut CByondValue, ) -> bool
sourcepub unsafe fn Byond_NewArglist(
&self,
type_: *const CByondValue,
arglist: *const CByondValue,
result: *mut CByondValue,
) -> bool
pub unsafe fn Byond_NewArglist( &self, type_: *const CByondValue, arglist: *const CByondValue, result: *mut CByondValue, ) -> bool
sourcepub unsafe fn Byond_Refcount(
&self,
src: *const CByondValue,
result: *mut u4c,
) -> bool
pub unsafe fn Byond_Refcount( &self, src: *const CByondValue, result: *mut u4c, ) -> bool
sourcepub unsafe fn ByondValue_IncRef(&self, src: *const CByondValue)
pub unsafe fn ByondValue_IncRef(&self, src: *const CByondValue)
Mark a reference as in use by Byondapi This should be done for any temporary references returned from other calls, if they need to be saved awhile. Blocks if not on the main thread.
§Arguments
src- The object to incref
sourcepub unsafe fn ByondValue_DecRef(&self, src: *const CByondValue)
pub unsafe fn ByondValue_DecRef(&self, src: *const CByondValue)
Mark a reference as no longer in use by Byondapi This can be used for temporary references to let them go immediately. Blocks if not on the main thread.
§Arguments
src- The object to decref