Turbesz Posted April 30, 2021 Posted April 30, 2021 for example i have 2 table with 2 different data and i want to show them in a column like this: [Table name1]: Data1 Data2 [Table name2]: Anotherdata1 Anotherdata2 How can i do it this with loops?
Moderators IIYAMA Posted April 30, 2021 Moderators Posted April 30, 2021 2 hours ago, Turbesz said: How can i do it this with loops? You can combine the tables first with for example this method table.merge. (make sure to copy the code) And then loop through them. Keep in mind that the table.merge method is mutating the first table. (mutating = changing the content of the table, instead of returning a new one) table1 = {1,2,3} table2 = {4,5,6} ---- local newTable = {} table.merge(newTable, table1, table2) -- or with table names table.merge(newTable, {"table1"}, table1, {"table2"}, table2) 1
Turbesz Posted May 1, 2021 Author Posted May 1, 2021 18 hours ago, IIYAMA said: You can combine the tables first with for example this method table.merge. (make sure to copy the code) And then loop through them. Keep in mind that the table.merge method is mutating the first table. (mutating = changing the content of the table, instead of returning a new one) table1 = {1,2,3} table2 = {4,5,6} ---- local newTable = {} table.merge(newTable, table1, table2) -- or with table names table.merge(newTable, {"table1"}, table1, {"table2"}, table2) Thank you, that's exactly what I want! 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now