Advertisement
Guest User

Untitled

a guest
Mar 19th, 2024
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.45 KB | None | 0 0
  1. class Exception
  2.     def fix_stack_save
  3.         @stack_backup = backtrace[0] unless @stack_backup
  4.     end
  5.    
  6.     alias :orig_backtrace :backtrace
  7.     def backtrace
  8.         stack = orig_backtrace
  9.         stack[0] = @stack_backup if @stack_backup
  10.         return stack
  11.     end
  12. end
  13.  
  14. module EvalFixer
  15.     def eval(script)
  16.         instance_eval %Q{
  17.             begin
  18.                 #{script}
  19.             rescue => ex
  20.                 ex.fix_stack_save
  21.                 raise ex
  22.             end
  23.         }
  24.     end
  25. end
  26.  
  27. class Game_Interpreter
  28.     include EvalFixer
  29. end
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement