Repository navigation
LuaAPI Modules
itvnnnd87 edited this page Oct 24, 2026
·
3 revisions
A module is a script in Includes\<Module>\ that attaches its own functions to game events. Every attached function runs isolated: if one module fails, the error is logged and every other module still runs.
function MyModule_OnLogin(aIndex)
Message.Send(aIndex, 1, "Hello " .. Player.GetName(aIndex))
end
BridgeFunctionAttach("OnCharacterEntry", "MyModule_OnLogin")Pass the function name as a string. Attaching the same function twice to one event has no effect.
| Module event | Fired by | Arguments | Return value |
|---|---|---|---|
OnReadScript |
onGameServerStart |
||
OnShutScript |
onScriptUnload |
||
OnTimerThread |
onTimerProcessSecond |
||
OnCommandManager |
onLuaCommand |
aIndex, cmdtype, code, arg |
0 = not mine, anything else = handled (the next modules are skipped). |
OnCharacterEntry |
onPlayerLogin |
aIndex |
|
OnCharacterClose |
onPlayerLogout |
aIndex |
|
OnUserDie |
onPlayerDie |
aIndex, killerIndex |
|
OnSQLAsyncResult |
onDBQueryResult |
label, param, result |
1 = result taken (stop), 2 = run the query again, anything else = pass to the next module. |
cmdtype is always 16 (the Type of LuaCommands.xml).
Every module can also use these short names. Each one calls the matching function of the function reference.
| Group | Functions |
|---|---|
| Server / objects |
GetGameServerCode GetMinUserIndex GetMaxUserIndex GetMinMonsterIndex GetMaxMonsterIndex GetObjectConnected GetObjectType GetObjectName GetObjectClass GetObjectMap GetObjectMapX GetObjectMapY GetObjectIndexByName GetMapName
|
| Character - read |
GetObjectAccount GetObjectAccountID GetObjectAccountLevel GetObjectPlayerID GetObjectLevel GetObjectMasterLevel GetObjectMajesticLevel GetObjectLevelUpPoint GetObjectMasterPoint GetObjectMajesticPoint GetObjectMoney GetObjectReset GetObjectPKCount GetObjectPKLevel GetObjectPKTimer GetObjectStrength GetObjectDexterity GetObjectVitality GetObjectEnergy GetObjectLeadership
|
| Character - write |
SetObjectLevel SetObjectLevelUpPoint SetObjectMasterPoint SetObjectMajesticPoint SetObjectMoney SetObjectPKCount SetObjectPKLevel SetObjectPKTimer ChangeObjectReset SetObjectStrength SetObjectDexterity SetObjectVitality SetObjectEnergy SetObjectLeadership
|
| Client updates / actions |
UserCalcAttribute UserInfoSend LevelUpSend MoneySend PKLevelSend UserDisconnect MoveUser MoveUserEx UserWarehouseOpen MasterSkillTreeRebuild ResetMajesticTree SetWindowText
|
| Cash shop |
CashShopGetPoint CashShopAddPoint CashShopSubPoint ObjectSubCoin
|
| Messages |
NoticeSend NoticeSendToAll NoticeGlobalSend MessageSend ChatTargetSend
|
| Items |
InventoryGetItemTable InsertItem_GremoryCaseEx
|
| Other |
LogColor LogPrint RandomGetNumber CommandGetArgNumber CommandGetArgString SQLAsyncQuery
|
Some other names are reserved for future versions. Calling one logs the error ...() is not supported by LuaAPI; the error only stops the function that called it.
Next: Complete example