#[repr(C)]pub struct playdate_lua {Show 32 fields
pub addFunction: Option<unsafe extern "C" fn(f: lua_CFunction, name: *const c_char, outErr: *mut *const c_char) -> c_int>,
pub registerClass: Option<unsafe extern "C" fn(name: *const c_char, reg: *const lua_reg, vals: *const lua_val, isstatic: c_int, outErr: *mut *const c_char) -> c_int>,
pub pushFunction: Option<unsafe extern "C" fn(f: lua_CFunction)>,
pub indexMetatable: Option<unsafe extern "C" fn() -> c_int>,
pub stop: Option<unsafe extern "C" fn()>,
pub start: Option<unsafe extern "C" fn()>,
pub getArgCount: Option<unsafe extern "C" fn() -> c_int>,
pub getArgType: Option<unsafe extern "C" fn(pos: c_int, outClass: *mut *const c_char) -> LuaType>,
pub argIsNil: Option<unsafe extern "C" fn(pos: c_int) -> c_int>,
pub getArgBool: Option<unsafe extern "C" fn(pos: c_int) -> c_int>,
pub getArgInt: Option<unsafe extern "C" fn(pos: c_int) -> c_int>,
pub getArgFloat: Option<unsafe extern "C" fn(pos: c_int) -> c_float>,
pub getArgString: Option<unsafe extern "C" fn(pos: c_int) -> *const c_char>,
pub getArgBytes: Option<unsafe extern "C" fn(pos: c_int, outlen: *mut usize) -> *const c_char>,
pub getArgObject: Option<unsafe extern "C" fn(pos: c_int, type_: *mut c_char, outud: *mut *mut LuaUDObject) -> *mut c_void>,
pub getBitmap: Option<unsafe extern "C" fn(pos: c_int) -> *mut LCDBitmap>,
pub getSprite: Option<unsafe extern "C" fn(pos: c_int) -> *mut LCDSprite>,
pub pushNil: Option<unsafe extern "C" fn()>,
pub pushBool: Option<unsafe extern "C" fn(val: c_int)>,
pub pushInt: Option<unsafe extern "C" fn(val: c_int)>,
pub pushFloat: Option<unsafe extern "C" fn(val: c_float)>,
pub pushString: Option<unsafe extern "C" fn(str_: *const c_char)>,
pub pushBytes: Option<unsafe extern "C" fn(str_: *const c_char, len: usize)>,
pub pushBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap)>,
pub pushSprite: Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>,
pub pushObject: Option<unsafe extern "C" fn(obj: *mut c_void, type_: *mut c_char, nValues: c_int) -> *mut LuaUDObject>,
pub retainObject: Option<unsafe extern "C" fn(obj: *mut LuaUDObject) -> *mut LuaUDObject>,
pub releaseObject: Option<unsafe extern "C" fn(obj: *mut LuaUDObject)>,
pub setUserValue: Option<unsafe extern "C" fn(obj: *mut LuaUDObject, slot: c_uint)>,
pub getUserValue: Option<unsafe extern "C" fn(obj: *mut LuaUDObject, slot: c_uint) -> c_int>,
pub callFunction_deprecated: Option<unsafe extern "C" fn(name: *const c_char, nargs: c_int)>,
pub callFunction: Option<unsafe extern "C" fn(name: *const c_char, nargs: c_int, outerr: *mut *const c_char) -> c_int>,
}Fields§
§addFunction: Option<unsafe extern "C" fn(f: lua_CFunction, name: *const c_char, outErr: *mut *const c_char) -> c_int>int playdate->lua->addFunction(lua_CFunction f, const char* name, const char** outErr);
Adds the Lua function f to the Lua runtime, with name name. (name can be a table path using dots, e.g. if name = “mycode.myDrawingFunction” adds the function “myDrawingFunction” to the global table “myCode”.) Returns 1 on success or 0 with an error message in outErr.
registerClass: Option<unsafe extern "C" fn(name: *const c_char, reg: *const lua_reg, vals: *const lua_val, isstatic: c_int, outErr: *mut *const c_char) -> c_int>int playdate->lua->registerClass(const char* name, const lua_reg* reg, const lua_val* vals, int isstatic, const char** outErr);
Creates a new “class” (i.e., a Lua metatable containing functions) with the given name and adds the given functions and constants to it. If the table is simply a list of functions that won’t be used as a metatable, isstatic should be set to 1 to create a plain table instead of a metatable. Please see C_API/Examples/Array for an example of how to use registerClass to create a Lua table-like object from C.
pushFunction: Option<unsafe extern "C" fn(f: lua_CFunction)>void playdate->lua->pushFunction(lua_CFunction f);
Pushes a lua_CFunction onto the stack.
indexMetatable: Option<unsafe extern "C" fn() -> c_int>int playdate->lua->indexMetatable(void);
If a class includes an __index function, it should call this first to check if the indexed variable exists in the metatable. If the indexMetatable() call returns 1, it has located the variable and put it on the stack, and the __index function should return 1 to indicate a value was found. If indexMetatable() doesn’t find a value, the __index function can then do its custom getter magic.
stop: Option<unsafe extern "C" fn()>void playdate->lua->stop(void);
Stops the run loop.
start: Option<unsafe extern "C" fn()>void playdate->lua->start(void);
Starts the run loop back up.
getArgCount: Option<unsafe extern "C" fn() -> c_int>int playdate->lua->getArgCount(void);
Returns the number of arguments passed to the function.
getArgType: Option<unsafe extern "C" fn(pos: c_int, outClass: *mut *const c_char) -> LuaType>enum LuaType playdate->lua->getArgType(int pos, const char** outClass);
Returns the type of the variable at stack position pos. If the type is kTypeObject and outClass is non-NULL, it returns the name of the object’s metatable.
argIsNil: Option<unsafe extern "C" fn(pos: c_int) -> c_int>int playdate->lua->argIsNil(int pos);
Returns 1 if the argument at the given position pos is nil.
getArgBool: Option<unsafe extern "C" fn(pos: c_int) -> c_int>int playdate->lua->getArgBool(int pos);
Returns one if the argument at position pos is true, zero if not.
getArgInt: Option<unsafe extern "C" fn(pos: c_int) -> c_int>int playdate->lua->getArgInt(int pos);
Returns the argument at position pos as an int.
getArgFloat: Option<unsafe extern "C" fn(pos: c_int) -> c_float>float playdate->lua->getArgFloat(int pos);
Returns the argument at position pos as a float.
getArgString: Option<unsafe extern "C" fn(pos: c_int) -> *const c_char>const char* playdate->lua->getArgString(int pos);
Returns the argument at position pos as a string.
getArgBytes: Option<unsafe extern "C" fn(pos: c_int, outlen: *mut usize) -> *const c_char>const char* playdate->lua->getArgBytes(int pos, size_t* outlen);
Returns the argument at position pos as a string and sets outlen to its length.
getArgObject: Option<unsafe extern "C" fn(pos: c_int, type_: *mut c_char, outud: *mut *mut LuaUDObject) -> *mut c_void>void* playdate->lua->getArgObject(int pos, char* type, LuaUDObject** outud);
Checks the object type of the argument at position pos and returns a pointer to it if it’s the correct type. Optionally sets outud to a pointer to the opaque LuaUDObject for the given stack.
getBitmap: Option<unsafe extern "C" fn(pos: c_int) -> *mut LCDBitmap>LCDBitmap* playdate->lua->getBitmap(int pos);
Returns the argument at position pos as an LCDBitmap.
getSprite: Option<unsafe extern "C" fn(pos: c_int) -> *mut LCDSprite>LCDSprite* playdate->lua->getSprite(int pos);
Returns the argument at position pos as an LCDSprite.
pushNil: Option<unsafe extern "C" fn()>void playdate->lua->pushNil(void);
Pushes nil onto the stack.
pushBool: Option<unsafe extern "C" fn(val: c_int)>void playdate->lua->pushBool(int val);
Pushes the int val onto the stack.
pushInt: Option<unsafe extern "C" fn(val: c_int)>void playdate->lua->pushInt(int val);
Pushes the int val onto the stack.
pushFloat: Option<unsafe extern "C" fn(val: c_float)>void playdate->lua->pushFloat(float val);
Pushes the float val onto the stack.
pushString: Option<unsafe extern "C" fn(str_: *const c_char)>void playdate->lua->pushString(char* str);
Pushes the string str onto the stack.
pushBytes: Option<unsafe extern "C" fn(str_: *const c_char, len: usize)>void playdate->lua->pushBytes(char* str, size_t len);
Like pushString(), but pushes an arbitrary byte array to the stack, ignoring \0 characters.
pushBitmap: Option<unsafe extern "C" fn(bitmap: *mut LCDBitmap)>void playdate->lua->pushBitmap(LCDBitmap* bitmap);
Pushes the LCDBitmap bitmap onto the stack.
pushSprite: Option<unsafe extern "C" fn(sprite: *mut LCDSprite)>void playdate->lua->pushSprite(LCDSprite* sprite);
Pushes the LCDSprite sprite onto the stack.
pushObject: Option<unsafe extern "C" fn(obj: *mut c_void, type_: *mut c_char, nValues: c_int) -> *mut LuaUDObject>LuaUDObject* playdate->lua->pushObject(void* obj, char* type, int nValues);
Pushes the given custom object obj onto the stack and returns a pointer to the opaque LuaUDObject. type must match the class name used in playdate->lua->registerClass(). nValues is the number of slots to allocate for Lua values (see set/getObjectValue()).
retainObject: Option<unsafe extern "C" fn(obj: *mut LuaUDObject) -> *mut LuaUDObject>LuaUDObject* playdate->lua->retainObject(LuaUDObject* obj);
Retains the opaque LuaUDObject obj and returns same.
releaseObject: Option<unsafe extern "C" fn(obj: *mut LuaUDObject)>void playdate->lua->releaseObject(LuaUDObject* obj);
Releases the opaque LuaUDObject obj.
setUserValue: Option<unsafe extern "C" fn(obj: *mut LuaUDObject, slot: c_uint)>void playdate->lua->setUserValue(LuaUDObject* obj, int slot);
Sets the value of object obj’s uservalue slot number slot (starting at 1, not zero) to the value at the top of the stack.
getUserValue: Option<unsafe extern "C" fn(obj: *mut LuaUDObject, slot: c_uint) -> c_int>int playdate->lua->getUserValue(LuaUDObject* obj, int slot);
Copies the value at obj’s given uservalue slot to the top of the stack and returns its stack position.
callFunction_deprecated: Option<unsafe extern "C" fn(name: *const c_char, nargs: c_int)>§callFunction: Option<unsafe extern "C" fn(name: *const c_char, nargs: c_int, outerr: *mut *const c_char) -> c_int>int playdate->lua->callFunction(const char* name, int nargs, const char** outerr);
Calls the Lua function name and and indicates that nargs number of arguments have already been pushed to the stack for the function to use. name can be a table path using dots, e.g. “playdate.apiVersion”. Returns 1 on success; on failure, returns 0 and puts an error message into the outerr pointer, if it’s set. Calling Lua from C is slow, so use sparingly.
Trait Implementations§
Source§impl Clone for playdate_lua
impl Clone for playdate_lua
Source§fn clone(&self) -> playdate_lua
fn clone(&self) -> playdate_lua
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for playdate_lua
impl Debug for playdate_lua
Source§impl Default for playdate_lua
impl Default for playdate_lua
Source§fn default() -> playdate_lua
fn default() -> playdate_lua
Source§impl Hash for playdate_lua
impl Hash for playdate_lua
Source§impl Ord for playdate_lua
impl Ord for playdate_lua
Source§impl PartialEq for playdate_lua
impl PartialEq for playdate_lua
Source§impl PartialOrd for playdate_lua
impl PartialOrd for playdate_lua
Source§fn partial_cmp(&self, other: &playdate_lua) -> Option<Ordering>
fn partial_cmp(&self, other: &playdate_lua) -> Option<Ordering>
impl Copy for playdate_lua
impl Eq for playdate_lua
impl StructuralPartialEq for playdate_lua
Auto Trait Implementations§
impl Freeze for playdate_lua
impl RefUnwindSafe for playdate_lua
impl Send for playdate_lua
impl Sync for playdate_lua
impl Unpin for playdate_lua
impl UnwindSafe for playdate_lua
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
§impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 128 bytes