Jump to content




list


  • You cannot reply to this topic
5 replies to this topic

#1 SpencerBeige

  • Members
  • 263 posts

Posted 14 February 2015 - 04:51 AM

t = {fs.list(path)}
for i = 1, #t do
  print(t[i])
end
doesn't return what i want

#2 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 14 February 2015 - 04:59 AM

I believe fs.list returns a table. So basically you're seeing t[1] being a table.

t = fs.list(path)
for i = 1, #t do
  print(t[i])
end


#3 SpencerBeige

  • Members
  • 263 posts

Posted 14 February 2015 - 01:43 PM

View PostDragon53535, on 14 February 2015 - 04:59 AM, said:

I believe fs.list returns a table. So basically you're seeing t[1] being a table.
 t = fs.list(path) for i = 1, #t do print(t[i]) end 
that's the same thing i wrote down...whats wrong with the code i wrote?

#4 Lignum

  • Members
  • 558 posts

Posted 14 February 2015 - 02:04 PM

View Postslow-coder, on 14 February 2015 - 01:43 PM, said:

that's the same thing i wrote down...whats wrong with the code i wrote?
Your code:
t = {fs.list(path)}

Dragon's code:
t = fs.list(path)


#5 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 14 February 2015 - 02:06 PM

It's not the same code you wrote. What you are doing in your code is putting all return values of fs.list into a table, which you then save to a variable. What Dragon53535 is doing is putting the first (and only) return value into a variable. fs.list return a numerically indexed table, so there is no need to put it into another table.

#6 SpencerBeige

  • Members
  • 263 posts

Posted 14 February 2015 - 02:16 PM

ohhhhh ok





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users