Helpers
il2cpp.find(pattern)
Sorted class names matching a Lua pattern.
print(table.concat(il2cpp.find("^Score"), ", ")) --> ScoreControl
| Parameter | Type | |
|---|---|---|
pattern | string |
Returns string[]
il2cpp.describe(class)
Every field and method of a class and its parents, for print.
print(il2cpp.describe(CS.ScoreControl)) --> ScoreControl --> UnityEngine.GameObject perfectJudge @0x20 --> UnityEngine.GameObject goodJudge @0x28 --> ...
| Parameter | Type | |
|---|---|---|
class | Unity |
Returns string
il2cpp.class(name)
A class whose name isn't a Lua identifier (List1`).
local List = il2cpp.class("System.Collections.Generic.List`1")
| Parameter | Type | |
|---|---|---|
name | string |
Returns Class
il2cpp.classof(obj)
An object's class.
print(il2cpp.classof(CS.UnityEngine.GameObject("x"))) --> class UnityEngine.GameObject local copy = il2cpp.classof(list)() -- a new object of the same class
| Parameter | Type | |
|---|---|---|
obj | Unity |
Returns Class
il2cpp.is(obj, class)
Whether an object is of a class or one deriving from it.
if il2cpp.is(loader, CS.AddressableImageLoader) then loader.Code = id end
| Parameter | Type | |
|---|---|---|
obj | Unity | |
class | Unity |
Returns boolean
il2cpp.alive(obj)
False for nil and for destroyed Unity objects.
on("update", function() if not il2cpp.alive(label) then return end -- its scene is gone label.text = tostring(stats().combo) end)
| Parameter | Type | |
|---|---|---|
obj | Unity? |
Returns boolean
il2cpp.typeof(class)
A System.Type.
local images = go:GetComponentsInChildren(il2cpp.typeof(CS.UnityEngine.UI.Image), true) print(images.Length)
| Parameter | Type | |
|---|---|---|
class | Unity |
Returns System.Type
il2cpp.string(s)
A System.String object.
local s = il2cpp.string("hello") -- for a method taking an object, where a Lua string wouldn't do
| Parameter | Type | |
|---|---|---|
s | string |
Returns System.String
il2cpp.bytes(s)
A byte[] of a Lua string.
local array = il2cpp.bytes("hi!") print(array.Length) --> 3
| Parameter | Type | |
|---|---|---|
s | string |
Returns byte[]
il2cpp.unbytes(array)
A Lua string of a byte[].
print(il2cpp.unbytes(CS.System.Text.Encoding.UTF8:GetBytes("hi!"))) --> hi!
| Parameter | Type | |
|---|---|---|
array | Unity |
Returns string
il2cpp.gc(on)
Stops the game's garbage collector, or starts it again with a collection (the core stops it during songs).
il2cpp.gc(false) -- no hitch while this runs build() il2cpp.gc(true)
| Parameter | Type | |
|---|---|---|
on | boolean |
phigrospp.hex(s)
Bytes as lowercase hex.
print(phigrospp.hex("hi!")) --> 686921
| Parameter | Type | |
|---|---|---|
s | string |
Returns string
phigrospp.unhex(s)
Hex as bytes.
print(phigrospp.unhex("686921")) --> hi!
| Parameter | Type | |
|---|---|---|
s | string |
Returns string
phigrospp.base64(s)
Bytes as base64.
print(phigrospp.base64("hi!")) --> aGkh
| Parameter | Type | |
|---|---|---|
s | string |
Returns string
phigrospp.unbase64(s)
Base64 as bytes.
print(phigrospp.unbase64("aGkh")) --> hi!
| Parameter | Type | |
|---|---|---|
s | string |
Returns string
phigrospp.crypto.verify(pub, msg, sig)
Whether an Ed25519 signature is the key's (raw bytes).
local ok = phigrospp.crypto.verify(phigrospp.unhex(KEY), data, phigrospp.read(path .. ".sig")) if not ok then return toast("Not signed by its author") end
| Parameter | Type | |
|---|---|---|
pub | string | |
msg | string | |
sig | string |
Returns boolean
phigrospp.phc(data)
The chart json of a .phc file.
local chart = phigrospp.json.decode(phigrospp.phc(phigrospp.read(phigrospp.dir() .. "IN.phc"))) print(#chart.judgeLineList)
| Parameter | Type | |
|---|---|---|
data | string |
Returns string
phigrospp.unzip(data)
The files of a zip, an error for the player when a path leaves the folder or it unpacks to too much.
local files = phigrospp.unzip(data) for path, bytes in pairs(files) do print(path, #bytes) end --> skin/tap.png 20431
| Parameter | Type | |
|---|---|---|
data | string |
Returns table<string, string>
phigrospp.decode(path)
Decodes audio on a thread: job:poll() gives nothing until a float[], channels and rate.
local job = phigrospp.decode(phigrospp.dir() .. "tap.ogg") local stop stop = every(0.1, function() local samples, channels, rate = job:poll() if not samples then return end print(samples.Length, channels, rate) --> 22050 2 44100 stop() end)
| Parameter | Type | |
|---|---|---|
path | string |
Returns { poll: fun(self): (Unity?, integer, integer) }
phigrospp.version
string
The Phigros++ running.
phigrospp.app
string
The Phigros++ the app came with.
phigrospp.native
integer
The native version the app was built for.
phigrospp.game
string
The game version the app was built for.