handle close event in lua

This commit is contained in:
Eduardo Bart
2012-01-07 03:35:50 -02:00
parent 806fb5995f
commit a3721b3a11
9 changed files with 34 additions and 12 deletions

View File

@@ -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 })