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 reference to that string, and increases the reference count. See REFERENCE COUNTING in byondapi.h. 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_SetStrId(&self, v: *mut CByondValue, strid: u4c)
pub unsafe fn ByondValue_SetStrId(&self, v: *mut CByondValue, strid: u4c)
Fills a CByondValue struct with a reference to a string with a given ID. Does not validate, and does not increase the reference count. If the strid is NONE, it will be changed to 0.
§Arguments
v
- Pointer to CByondValuestrid
- 4-byte string ID [Byond_TestRef()
]
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) All references created from Byondapi calls within your callback are persistent, not temporary, even though your callback runs on the main thread. 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
Returns a reference to an existing string ID or creates a new string ID reference. The new string is reference-counted. See REFERENCE COUNTING in byondapi.h for details. Call ByondValue_SeStrId() to use the returned ID in a CByondValue. Blocks if not on the main thread.
§Arguments
str
- Null-terminated string
§Returns
ID of string; NONE if string creation failed
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 Byond_PixLoc(
&self,
src: *const CByondValue,
pixloc: *mut CByondPixLoc,
) -> bool
pub unsafe fn Byond_PixLoc( &self, src: *const CByondValue, pixloc: *mut CByondPixLoc, ) -> bool
Sourcepub unsafe fn Byond_BoundPixLoc(
&self,
src: *const CByondValue,
dir: u1c,
pixloc: *mut CByondPixLoc,
) -> bool
pub unsafe fn Byond_BoundPixLoc( &self, src: *const CByondValue, dir: u1c, pixloc: *mut CByondPixLoc, ) -> bool
Sourcepub unsafe fn ByondValue_IncRef(&self, src: *const CByondValue)
pub unsafe fn ByondValue_IncRef(&self, src: *const CByondValue)
Increase the persistent reference count of an object used in Byondapi Reminder: Calls only create temporary references when made on the main thread. On other threads, the references are already persistent. 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 persistent reference as no longer in use by Byondapi This is IMPORTANT to call when you make Byondapi calls on another thread, since all the references they create are persistent. This cannot be used for temporary references. See ByondValue_DecTempRef() for those. Blocks if not on the main thread.
§Arguments
src
- The object to decref
Sourcepub unsafe fn ByondValue_DecTempRef(&self, src: *const CByondValue)
pub unsafe fn ByondValue_DecTempRef(&self, src: *const CByondValue)
Mark a temporary reference as no longer in use by Byondapi Temporary references will be deleted automatically at the end of a tick, so this only gets rid of the reference a little faster. Only works on the main thread. Does nothing on other threads.
§Arguments
src
- The object to decref
Sourcepub unsafe fn Byond_TestRef(&self, src: *mut CByondValue) -> bool
pub unsafe fn Byond_TestRef(&self, src: *mut CByondValue) -> bool
Sourcepub unsafe fn Byond_CRASH(&self, message: *const c_char)
pub unsafe fn Byond_CRASH(&self, message: *const c_char)
Causes a runtime error to crash the current proc Blocks if not on the main thread.
§Arguments
message
- Message to use as the runtime error