objc
Send Objective-C messages. Installed by the ffi capability on the cocos (Cocotron) builds — iOS and Android. The Miniclip cocos titles run a Cocotron Objective-C runtime on Android too, so the runtime functions resolve on both. On non-cocos games (il2cpp/Unity, e.g. Mobile Legends) objc is nil and not installed. arm64.
objc.class
Section titled “objc.class”objc.class(name: string): pointer|nil
Returns the Class object for name, or nil.
objc.object
Section titled “objc.object”objc.object(p: pointer|integer): object
Wraps an id as an object userdata.
objc.selector
Section titled “objc.selector”objc.selector(name: string): integer
Returns the SEL for name. Rarely needed; obj:msg takes a selector string directly.
object userdata
Section titled “object userdata”obj:msg
Section titled “obj:msg”obj:msg(selector: string, signature: string, ...): any
| Argument | Type | Description |
|---|---|---|
| selector | string | The Objective-C selector, e.g. "setHidden:". |
| signature | string | The ffi signature of the method without self/_cmd, e.g. "v(b)". |
| … | The arguments. |
Sends selector to the object through objc_msgSend, marshalling self and _cmd for you. Return typed as in ffi.call.
| Method | Returns | Description |
|---|---|---|
obj:class() |
pointer | The object’s class. |
obj:class_name() |
string | The class name. |
obj:responds(selector) |
boolean | Whether the object responds to a selector. |
obj.pointer |
pointer | The underlying id. tostring(obj) is its address. |
-- hide a UIView-like objectlocal view = objc.object(some_pointer)view:msg("setHidden:", "v(b)", true)