def set_error_handler(lua_code=nil, &block)

      if lua_code == nil && block

        function('_ruby_error_handler', &block)
        stack_load_path('_ruby_error_handler')
        @error_handler = stack_top

      elsif lua_code == nil

        Lib.lua_remove(@pointer, @error_handler) if @error_handler > 0
        @error_handler = 0

      elsif lua_code == :traceback

        stack_load_path('debug.traceback')
        @error_handler = stack_top

      else

        lua_code = lua_code.strip
        lua_code = 'return ' + lua_code unless lua_code.match(/^return\s+/)

        r = self.eval(lua_code)
        r.send(:load_onto_stack)
        @error_handler = stack_top
      end
    end
def set_error_handler(lua_code=nil, &block)

      if lua_code == nil && block

        function('_ruby_error_handler', &block)
        stack_load_path('_ruby_error_handler')
        @error_handler = stack_top

      elsif lua_code == nil

        Lib.lua_remove(@pointer, @error_handler) if @error_handler > 0
        @error_handler = 0

      elsif lua_code == :traceback

        stack_load_path('debug.traceback')
        @error_handler = stack_top

      else

        lua_code = lua_code.strip
        lua_code = 'return ' + lua_code unless lua_code.match(/^return\s+/)

        r = self.eval(lua_code)
        r.send(:load_onto_stack)
        @error_handler = stack_top
      end
    end
Instantiates a Lua state (runtime).

 Accepts an 'include_libs' optional arg. When set to true (the default,
 all the base Lua libs are loaded in the runtime.

 This optional arg can be set to false, when no libs should be present, or
 to an array of libs to load in order to prepare the state.

 The list may include 'base', 'package', 'table', 'string', 'math', 'io',
 'os' and 'debug'.