Xwad Posted March 21, 2019 Share Posted March 21, 2019 (edited) i have a table with elements inside it. if the number of elements inside the table are 0 or 1 then do a calculation with the number (#table) which will be the result of 10. If the number of elements are 2 or 3 then do the same calculation which will be the result of 20. And the same with result 30,40,50,60, etc.... Is this possible? (i need it for an auto positioning gui element) Edited March 21, 2019 by Xwad Link to comment
Moderators IIYAMA Posted March 21, 2019 Moderators Share Posted March 21, 2019 @Xwad Master this loop and all possibility will open up to you. local theTable = {[0] = 0, 1,2,3,4,5,6,7} local index = 1 for i=0, #theTable, 2 do print("position: ", index * 10) index = index + 1 print("index: ", theTable[i]) print("index: ", theTable[i + 1]) print("---") end Link to comment
Xwad Posted March 21, 2019 Author Share Posted March 21, 2019 YES i did it+! Thanks for the hint! 1 Link to comment
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