Last active
August 18, 2016 17:47
-
-
Save raingloom/f1b06b5d10a068d8abe49ff04be3e42c to your computer and use it in GitHub Desktop.
Mobdebug metamethod tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local evilmt = { "somevalue" } | |
---[[ | |
function evilmt:__pairs() | |
return pairs{"Wrong table :P"}--the output is not what I expected but it is also not correct | |
--return next,self--for normal output | |
end--]] | |
setmetatable( evilmt, evilmt ) | |
while true do | |
print( evilmt ) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local evilmt = { "somevalue" } | |
---[[ | |
function evilmt:__tostring() | |
error"NO OUTPUT FOR YOU! HAH!"--clears whole stack window and only shows error message | |
end--]] | |
setmetatable( evilmt, evilmt ) | |
while true do | |
print( evilmt ) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local evilmt = { "somevalue" } | |
---[[ | |
function evilmt:__tostring() | |
error( self )--use the fact that `error` can return any value against the debugger | |
end--]] | |
setmetatable( evilmt, evilmt ) | |
while true do | |
print'running'--this line is never executed but there is no error message either | |
--it executes without problems when ran directly | |
--but crashes in the debugger | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment