Dice Posted August 19, 2013 Posted August 19, 2013 example tab = { { "nme", "text"}, { "nme2", "text2"}, { "nme3", "text3"} } I want to print nme, txt for each table.
DNL291 Posted August 19, 2013 Posted August 19, 2013 outputChatBox(tab[1][1]) --> nme outputChatBox(tab[1][2]) --> text outputChatBox(tab[3][2]) --> text3 Please do not PM me with scripting related question nor support, use the forums instead.
Dice Posted August 19, 2013 Author Posted August 19, 2013 yeah I know that method but the thing is, I am using table.insert so the sizes can vary, how can i make sure it gets it all.
DNL291 Posted August 19, 2013 Posted August 19, 2013 What do you mean? You want to get all items of the table or what? Please do not PM me with scripting related question nor support, use the forums instead.
Dice Posted August 19, 2013 Author Posted August 19, 2013 for i = 1,#tab do outputChatBox ( tab[i][1] .. " " .. tab[i][2] ) end
Moderators IIYAMA Posted August 19, 2013 Moderators Posted August 19, 2013 for index1 = 1,#tab do local tabContents = tab[index1] local newString for index2 = 1,#tabContents do newString = tabContents[index2].. " " end if newString then outputChatBox(newString) end end You mean something like this? 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
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