4
For example:
minion = {
hp = 1000,
x = 10,
y = 25
}
Is there a function I can know how many variables there are within this table?
4
For example:
minion = {
hp = 1000,
x = 10,
y = 25
}
Is there a function I can know how many variables there are within this table?
4
There’s already a size response. To traverse the elements:
minion = {
hp = 1000,
x = 10,
y = 25 }
for i, v in pairs(minion) do
print(i, "=>", v)
end
Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.
Browser other questions tagged lua lua-table
You are not signed in. Login or sign up in order to post.