Swift 6.4 migration and exhancements (#1)
This PR contains the work done to update the library and the attached example project to use the Swift 6.4 computer as a minimum supported version and also, to use the latest features introduced in it. Reviewed-on: #1 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -5,26 +5,23 @@ extension Lua {
|
||||
public struct UDObject {
|
||||
let pointer: OpaquePointer
|
||||
|
||||
/// Prevents the object from being garbage-collected until `release()`.
|
||||
/// Prevents garbage collection until a balancing `release()`. Returns `self`.
|
||||
@discardableResult
|
||||
public func retain() -> UDObject {
|
||||
UDObject(pointer: luaAPI.pointee.retainObject.unsafelyUnwrapped(pointer).unsafelyUnwrapped)
|
||||
}
|
||||
|
||||
/// Balances a `retain()`, allowing the object to be
|
||||
/// garbage-collected again.
|
||||
/// Balances one `retain()`.
|
||||
public func release() {
|
||||
luaAPI.pointee.releaseObject.unsafelyUnwrapped(pointer)
|
||||
}
|
||||
|
||||
/// Pops the value on top of the stack and stores it in the object's
|
||||
/// user-value `slot` (1-based).
|
||||
/// Sets user-value `slot` (1-based) to the top stack value.
|
||||
public func setUserValue(slot: UInt32) {
|
||||
luaAPI.pointee.setUserValue.unsafelyUnwrapped(pointer, slot)
|
||||
}
|
||||
|
||||
/// Pushes the value in user-value `slot` onto the stack and returns
|
||||
/// its stack position, or `nil` if there is none.
|
||||
/// Pushes user-value `slot` (1-based); returns its stack position, or `nil` if 0.
|
||||
@discardableResult
|
||||
public func getUserValue(slot: UInt32) -> Int? {
|
||||
let position = luaAPI.pointee.getUserValue.unsafelyUnwrapped(pointer, slot)
|
||||
|
||||
Reference in New Issue
Block a user