def stack_to_s

      # warning : don't touch at stack[0]

      s = (1..stack_top).inject([]) { |a, i|

        type, tname = stack_type_at(i)

        val =
          if type == TSTRING
            "\"#{stack_fetch(i)}\""
          elsif SIMPLE_TYPES.include?(type)
            stack_fetch(i).to_s
          elsif type == TTABLE
            "(# is #{Lib.lua_objlen(@pointer, i)})"
          else
            ''
          end

        a << "#{i} : #{tname} (#{type}) #{val}"
        a
      }.reverse.join("\n")

      s += "\n" if s.length > 0

      s
    end
def stack_to_s

      # warning : don't touch at stack[0]

      s = (1..stack_top).inject([]) { |a, i|

        type, tname = stack_type_at(i)

        val =
          if type == TSTRING
            "\"#{stack_fetch(i)}\""
          elsif SIMPLE_TYPES.include?(type)
            stack_fetch(i).to_s
          elsif type == TTABLE
            "(# is #{Lib.lua_objlen(@pointer, i)})"
          else
            ''
          end

        a << "#{i} : #{tname} (#{type}) #{val}"
        a
      }.reverse.join("\n")

      s += "\n" if s.length > 0

      s
    end
Returns a string representation of the state's stack.