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? What if the only way not to feel bad, is to stop feeling, anything at all, forever? - Hannah Baker I cost a girl her life because I was afraid to love her... - Clay Jensen ~ 13 Reasons Why
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 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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 What if the only way not to feel bad, is to stop feeling, anything at all, forever? - Hannah Baker I cost a girl her life because I was afraid to love her... - Clay Jensen ~ 13 Reasons Why
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