def stack_fetch(pos=-1)

      type, tname = stack_type_at(pos)

      case type

      when TNIL then nil

      when TSTRING then
        len = FFI::MemoryPointer.new(:size_t)
        ptr = Lib.lua_tolstring(@pointer, pos, len)
        ptr.read_string(len.read_long)

      when TBOOLEAN then (Lib.lua_toboolean(@pointer, pos) == 1)
      when TNUMBER then Lib.lua_tonumber(@pointer, pos)

      when TTABLE then Table.new(@pointer)
        # warning : this pops up the item from the stack !

      when TFUNCTION then Function.new(@pointer)
      when TTHREAD then Coroutine.new(@pointer)

      else tname
      end
    end
def stack_fetch(pos=-1)

      type, tname = stack_type_at(pos)

      case type

      when TNIL then nil

      when TSTRING then
        len = FFI::MemoryPointer.new(:size_t)
        ptr = Lib.lua_tolstring(@pointer, pos, len)
        ptr.read_string(len.read_long)

      when TBOOLEAN then (Lib.lua_toboolean(@pointer, pos) == 1)
      when TNUMBER then Lib.lua_tonumber(@pointer, pos)

      when TTABLE then Table.new(@pointer)
        # warning : this pops up the item from the stack !

      when TFUNCTION then Function.new(@pointer)
      when TTHREAD then Coroutine.new(@pointer)

      else tname
      end
    end
Fetches the top value on the stack (or the one specified by the optional
 pos parameter), but does not 'pop' it.