def to_h

      load_onto_stack

      table_pos = stack_top

      Lib.lua_pushnil(@pointer)

      h = {}

      while Lib.lua_next(@pointer, table_pos) != 0 do

        value = stack_fetch(-1)
        value.load_onto_stack if value.is_a?(Ref)

        key = stack_fetch(-2)
        key.load_onto_stack if key.is_a?(Ref)

        stack_unstack # leave key on top

        h[key] = value
      end

      h
    end
def to_h

      load_onto_stack

      table_pos = stack_top

      Lib.lua_pushnil(@pointer)

      h = {}

      while Lib.lua_next(@pointer, table_pos) != 0 do

        value = stack_fetch(-1)
        value.load_onto_stack if value.is_a?(Ref)

        key = stack_fetch(-2)
        key.load_onto_stack if key.is_a?(Ref)

        stack_unstack # leave key on top

        h[key] = value
      end

      h
    end
Returns a Ruby Hash instance representing this Lua table.