This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
SpencerBeige's profile picture

returning a table

Started by SpencerBeige, 29 December 2014 - 11:27 PM
SpencerBeige #1
Posted 30 December 2014 - 12:27 AM
trying to use return function to return a table
valithor #2
Posted 30 December 2014 - 12:33 AM
-snip

A few examples of returning a table from a function

function func1()
  return {"entry1","entry2"}
end

func1table = func1()



tbl = {"entry1","entry2"}
function func2()
  return tbl
end
func2table = func2()
  

I know my variable names are extremely descriptive.
Edited on 29 December 2014 - 11:47 PM
SpencerBeige #3
Posted 30 December 2014 - 12:37 AM
thx
SpencerBeige #4
Posted 30 December 2014 - 12:51 AM
wuht about reading a table from an api?
KingofGamesYami #5
Posted 30 December 2014 - 02:59 AM
What do you mean by "reading a table"? If you mean returning a table, exactly the same way. Just make a function in your api that returns the table.