I am editing a code, with two shapes in the scene (the circle and the ground), they're each in a table
is there a way I can get the amount of objects inside the table?
How to get number of objects/shapes in scene?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
How to get number of objects/shapes in scene?
What a wonderful caricature of intimacy
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: How to get number of objects/shapes in scene?
Code: Select all
#table
- HugoBDesigner
- Party member
- Posts: 403
- Joined: Mon Feb 24, 2014 6:54 pm
- Location: Above the Pocket Dimension
- Contact:
Re: How to get number of objects/shapes in scene?
If you have simply an array table, you can just use:
But if you have a table with multiple different items in it (for example "table.x", "table['n']" and others), you can use this function I made (which is quite simple, so someone else probably already made it before):
Code: Select all
amount = #myTable
Code: Select all
amount = table.size(myTable)
Code: Select all
function table.size(t)
local s = 0
for i, v in pairs(t) do
s = s + 1
end
return s
end
Who is online
Users browsing this forum: slime and 3 guests