mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
handle close event in lua
This commit is contained in:
@@ -60,5 +60,15 @@ function Game.onDeath()
|
||||
print('dead')
|
||||
end
|
||||
|
||||
local function onApplicationClose()
|
||||
print('close app')
|
||||
if Game.isOnline() then
|
||||
Game.logout(false)
|
||||
else
|
||||
exit()
|
||||
end
|
||||
end
|
||||
|
||||
setonclose(onApplicationClose)
|
||||
connect(Game, { onLogin = Game.createInterface }, true)
|
||||
connect(Game, { onLogout = Game.destroyInterface })
|
||||
|
Reference in New Issue
Block a user