Heres what Im trying to do:
Code: Select all
cool_table = {
size = {
w = 10,
h = 10
}
quad = AssetManager:getQuad(size.w, size.h) -- < id like to access the size table here, but im not sure how
}
Code: Select all
cool_table = {
size = {
w = 10,
h = 10
}
quad = AssetManager:getQuad(size.w, size.h) -- < id like to access the size table here, but im not sure how
}
that's impossible, the table doesn't exist until all of the statement id done. You can do this instead:ismyhc wrote:New lua user here. When creating a table, how can I access the value of a table while inside of the table?
Heres what Im trying to do:
Any help much appreciated!Code: Select all
cool_table = { size = { w = 10, h = 10 } quad = AssetManager:getQuad(size.w, size.h) -- < id like to access the size table here, but im not sure how }
Code: Select all
cool_table = {}
cool_table.size = { w = 10, h = 10 }
cool_table.quad = AssetManager:getQuad(cool_table.size.w, cool_table.size.h)
Code: Select all
cool_table = {
size = {
w = 10,
h = 10
}
}
cool_table.quad = AssetManager:getQuad(cool_table.size.w, cool_table.size.h)
Code: Select all
local _w,_h = 10,10
cool_table = {
size = {
w = _w,
h = _h
},
quad = AssetManager:getQuad(_w, _h)
}
Code: Select all
cool_table = {
size = {
w = 10,
h = 10
},
quad = AssetManager:getQuad(10, 10)
}
Well that explains it!S0lll0s wrote:that's impossible, the table doesn't exist until all of the statement id done. You can do this instead:ismyhc wrote:New lua user here. When creating a table, how can I access the value of a table while inside of the table?
Heres what Im trying to do:
Any help much appreciated!Code: Select all
cool_table = { size = { w = 10, h = 10 } quad = AssetManager:getQuad(size.w, size.h) -- < id like to access the size table here, but im not sure how }
Code: Select all
cool_table = {} cool_table.size = { w = 10, h = 10 } cool_table.quad = AssetManager:getQuad(cool_table.size.w, cool_table.size.h)
Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests