Advertisement
KananGamer

[TFM-LUA] Try-Catch

Jul 10th, 2018
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.32 KB | None | 0 0
  1. function game()
  2.     local v = ''
  3.     print(1 + v)
  4. end
  5.  
  6. function catch(what) return what[1] end function try(what) status, result = pcall(what[1]) if not status then what[2](result) end return result end try{function() game() end, catch{function(erro) ui.addTextArea(1, '<R>'..erro..'</R>', nil, 5, 26, 0, 0, 1, 1, 1, true) end}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement