-
Notifications
You must be signed in to change notification settings - Fork 1
Lua functions
Piotr Halama edited this page Aug 14, 2025
·
21 revisions
Table of libraries and their function All functions are called as library.fucntionName() from Lua, except the bace ones (error, next, etc.)
Standard Lua libraries: str is something like a const char*
base functions & libraries
- base functions - some functions were cut, e.g.
require()
error()
getmetatable()
setmetatable()
getfenv()
setfenv()
next()
ipairs()
pairs()
print()
toint()
tostring()
type()
assert()
unpack()
rawequal()
rawget()
rawset()
pcall()
xpcall()
collectgarbage()
gcinfo()
loadstring()
- missing function -
require()
-
coroutine
- loaded as a part ofbase
create()
wrap()
resume()
yield()
status()
-
table
concat()
foreach()
foreachi()
getn()
setn()
sort()
insert()
remove()
-
string
len()
sub()
lower()
upper()
char()
rep()
byte()
format()
dump()
find()
gfind()
gsub()
-
debug
gsub()
getlocal()
getinfo()
gethook()
getupvalue()
sethook()
setlocal()
setupvalue()
debug()
traceback()
Non-standard libraries:
-
gl
-
SelectOSDMode(str mode)
- possible modes:
844
,655
,4444
,4633
- possible modes:
BeginScene()
EndScene()
int CreateOverlayFromTexture(int i)
FreeOverlay(int i)
int LoadTexture(int i, str s)
FreeTexture(int i)
AddTextureToOverlay(int i, int j)
RemoveTextureFromOverlay(int i, int j)
SetTextureActiveFrame(int i, int j)
SetClipInfo(int i, int j, int k, int l, int m)
-
SetParameters(int i, int j, int k, int l, int m)
- identical to the
SetClipInfo()
- identical to the
SetZorder(int i, int j)
SetVisibility(int i, int j)
SetPosition(int i, int j, int k)
int GetZorder(int i)
int GetVisibility(int i)
int, int GetPosition(int i)
int, int GetSize(int i)
ClearOSD()
Show(int i)
int HasAnimations(int i)
DeleteAllAnimations(int i)
AddPositionAnimation(int i, int j, int k, int l, int m, int n, int o)
AddVisibilityAnimation(int i, int j, int k)
AddParabolaAnimation(int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t)
AddBlinkingAnimation(int i, int j, int k, int l, int m)
AddAlphaAnimation(int i, int j, int k, int l)
-
CreateTextureAnimation(int i, int j, int [][]t)
- TODO tables, I don't know if I read this correctly
- expects a table of 11 tables of 3 ints,
int [11][3]
int CreateEmptyTexture(int i, int j, str s)
-
BlitOverlay(int i, int j, int k, int l)
- with optional
int m
andint n
- with optional
-
BlitOverlayWithCR(int i, int j, int k, int l)
- with optional
int m
,int n
, mnopqrstuvw
- with optional
SetTextureAlphaLevel(int i, int j)
-
-
rm
- Resource Manager-
int OpenResource(str path)
- loads resource s and returns ID of the loaded resource.
- For directories the path has to begin and end with
/
.
CloseResource(int i)
lightUserData, int LoadFile(int i, str s)
UnloadFile(int i, userData u)
-
-
time
int GetRealTime()
Sleep(int ms)
-
log
-
Log(int level, str message)
- prints somewhere if level is lower or equal to currently set log level
-
SetLevel(int level)
- sets logging level (default is ???)
- LOG_NONE - 0
- LOG_CRITICAL - 1
- LOG_IMPORTANT - 2
- LOG_NORMAL - 3
- LOG_VERBOSE - 4
- LOG_DEBUG - 5
SetModule(int i, int j)
-
PrintRaw(str message)
- prints somewhere if sebug state is enabled
-
PrintLine(str message)
- prints somewhere
-
DebugSetState(int enabled)
- sets debug state 0/1
-
PrintRaw
works only ifenabled
is non-zero
-
-
pointer
-
lightUserData *CreateUserData(int size)
- probably allocs
size
bytes of space
- probably allocs
-
DestroyUserData(userData u)
- empty func???? str ToString(userData u)
-
str ToStringRange(userData u, int min, int max)
- returns
[min, max)
bytes of data
- returns
lightUserData FromString(str s)
int GetIndex(userData u, int i)
int GetU32MSB(userData u, int i)
SetU32MSB(userData u, int i, int j)
int GetU32LSB(userData u, int i)
SetU32LSB(userData u, int i, int j)
str ByteToAscii(int i)
int AsciiToByte(str s)
-
-
zmath
- there is no standardmath
library includedint Mod(int i, int j)
-
int Rand(int min, int max)
- gets random int that
min <= n <= max
- TODO check if this is correct
- gets random int that
-
RandSeed(int i)
- initializes Rand, seed can be set to time.GetRealTime()
-
input
ClearKeyQueue()
int, int, int GetKey()
int, int, int WaitForKey()
int EnableRemotes()
int DisableRemotes()
-
SetMode(int mode)
- known modes: 0 - 4, defaults to 0
int GetMode()
SetQueueSize(int size)
-
SetRandomKeysTable(int []t)
- I have no idea if I read this function correctly, or how many elelkemts in a table is expected (4?)
-
iframe
int Load(int resID, str filename)
Unload(int id)
Show(int i)
-
ShowPredefined(int i)
- i==0 might be different from the rest?
- only VeggieTales uses this function apparently -
ShowPredefined(2)
- possible known files
- 0 -
game_wave.m2v
? - GameWave logo screen - 1 -
insert_disc.m2v
? - "Please insert disc...` screen - 2 -
launching.m2v
-Launching game...
orStarting game...
screen, depending on the engine version
- 0 -
Clear()
-
engine
ZMM_SetLeakDebugMode(int enabled)
ZMM_SetCheckPoint()
ZMM_VerifyCheckPoint()
int ZMM_GetTotalAllocMemory()
int ZMM_GetTotalFreeMemory()
int ZMM_GetMaxFreeMemory()
DR_SetEnable(int i)
DR_SetDebug(int i)
DR_SetAbsoluteCapping(int i, int j, int k)
DR_ClearPairCappings(int i, int j, int k)
DR_AddPairCapping()
OpenTray()
CloseTray()
-
EjectTray()
- exactly the same as
OpenTray()
- exactly the same as
int GetTrayState()
SoftwareReset()
WaitForDisk()
int GetNumOverlays()
int GetNumTextures()
-
str Version()
- returns something like
1.01.3.xxxxxx
- returns something like
-
SetLineTraceMode(int enabled)
- expects 0/1
int GetLineTraceMode()
-
text
int RenderSimple(int i, str s)
-
Render(str s, int i, int j, int k)
- possible 10 optional args????
Remove(int i)
int GetOverlayId(int i)
-
font
int Load(int loc, str filepath)
Free(int i)
-
int GetBuiltinFontID()
- the builtin font is called
f_1955_s_22_m_4633_32_128.dat
- the builtin font is called
-
movie
-
int Load(str path)
- path is a full name,
movie
doesn't userm
library
- path is a full name,
SetLoop(int i)
Play()
Stop(int i)
Resume()
-
int GetState()
- returns 0 if it's still playing, needs to be checked in a loop
-
-
audio
int Load(int i, str s)
Unload(int i)
Play(int i , int j)
-
spi
int Init()
int Open()
int Close()
int Write(userData u, int i,int j)
lightUserData Read(int i, int j)
-
uart
str RxD()
int TxD(str s, int i)
-
int Open()
- returns 1, does nothing
-
int Close()
- returns 1, does nothing
-
eeprom
bool SaveGameToNewSlot(int i, int j, str s, str s2, userData u)
str, str, bool GetSaveNameByID(int i,)
lightUserData, bool LoadSaveByID(int i)
UnloadData(userData u)
bool SaveGameToExistingSlot(int i, userData u)
-
int, bool EnumerateGameSavesByID(int i)
- returns
number_of_slots, 0
- returns
-
int, bool EnumerateGameSavesByName(str s)
- returns
number_of_slots, 0
- returns
Format()
CorruptFlash()
int CheckFlashIntegrity()
-
zfile
-
int OpenFile(str path)
- doesn't use
rm
- optional
int i
andint loc
arguments, defaults to 0 -
i
is checked against 0 and -1 (and else) -
loc
is only used when i is not 0 or -1,loc
has to beloc >= 0
, seedict.Load()
- returns -1 on error
- doesn't use
-
lightUserData ReadBytes(int i, int j, int k)
- can return
nil
- returns buffer; to free memory use
pointer.DestroyUserData(buffer)
after closing / after read
- can return
-
int, str ReadLine(int i)
- returned int is set to
0
if string is returned - returned int is set to
1
ifnil
is returned
- returned int is set to
int SetHeadPosition(int i, int j)
int GetFileSize(int id)
int CloseFile(int id)
-
-
dict
-
lightUserData Load(int loc, str filename)
-
loc
might be place where to load files from (DVD, HDD etc.) - filename contains
.zdt
extension
-
Unload(userdata i)
bool Lookup(userdata i, str s)
-
-
exp_int
- there are mentions of INT port whatever it isint Configure(bool i)
int Close()
int Test()
-
bit
-
int bnot(int i)
- not -
int band(int i, ...)
- and -
int bor(int i, ...)
- or -
int bxor(int i, ...)
- xor int lshift(int i, int j)
-
int rshift(int i, int j)
- looks like unsigned right shift -
int arshift(int i, int j)
- looks like signed right shift int mod(int i, int j)
-