function1
weaponsList.earth = {weapon_type='regular',fireTime=0, fireRate=0.7, speed = 250, img = nil}
end
你能做這樣的事情來訪問子成員嗎?消除Lua中表格的前綴
"using weaponsList,earth"
fireTime = 2
fireRate = 2
speed = 2
end
,而不必爲此
weaponsList.earth.fireTime = 2
weaponsList.earth.fireRate = 2
weaponsList.earth.speed = 2
不知道這是什麼所謂的,但我已經用C或C++看出這一點。有沒有辦法在Lua做到這一點,它是什麼叫什麼名字?
改變't.speed' *將*'改變weaponsList.earth.speed'。 – lhf