Jump to content

Math question


Xwad

Recommended Posts

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 by Xwad
Link to comment
  • Moderators

@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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...