Jump to content




Lua [help please]


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

#1 predatorxil

  • Members
  • 19 posts

Posted 22 October 2012 - 02:37 PM

Im trying to print my table of user so i dont have to type them out. anything will help, all i want is to print wahts in the table, such as users

#2 Ditto8353

  • New Members
  • 138 posts

Posted 22 October 2012 - 02:50 PM

If you just want one user per line, it's pretty simple:

for i,v in ipairs(userTable) do
   print(v)
end

And if you wanted, lets say, 3 users per line you could do something like this:

local pad = "     "
local usersPerLine = 3
for i,v in ipairs(userTable) do
   write(v)
   if i % usersPerLine == 0 then
      print()
   else
      write(pad)
   end
end


#3 faubiguy

  • Members
  • 213 posts

Posted 22 October 2012 - 02:51 PM

textutils.tabulate(someTable) will print out the items that are in the indexed portion of a table. Use textutils.pagedTabulate(someTable) if the table contents go past the terminal height

#4 Ditto8353

  • New Members
  • 138 posts

Posted 22 October 2012 - 02:54 PM

...I should really pay more attention to the APIs that CC has...





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users