- Joined
- Nov 17, 2010
- Messages
- 6,834
- Solutions
- 586
- Reaction score
- 5,424
Pre-Existing Table.
How it will look, when I add information into the table..
But how do I add the information into the table?
The original value I can add in like this..
Which I think would make the table look like this..
But how do I add additional "{x, y}" 's into that pre-existing array.. without deleteing the previous array?
Do I use table.insert..?
This seems right.. but just trying to wrap my head around it.
If someone can say Aye or Nay, with a small explanation.. That'd be really helpful.
Thanks!
Xikini
Lua:
local t = {
a = {},
b = {},
c = {}
}
Lua:
local t = {
a = {value = {{x, y}, {x, y}, {x, y}}, value2 = {{x, y}, {x, y}, {x, y}}, value3 = {{x, y}, {x, y}, {x, y}} },
b = {},
c = {}
}
But how do I add the information into the table?
The original value I can add in like this..
Lua:
t.a.value = {x, y}
Lua:
local t = {
a = {value = {{x, y}} },
b = {},
c = {}
}
Do I use table.insert..?
Lua:
if not t.a.value then
t.a.value = {x, y}
else
table.insert(t.a.value, {x, y})
end
This seems right.. but just trying to wrap my head around it.
If someone can say Aye or Nay, with a small explanation.. That'd be really helpful.
Thanks!
Xikini