function1
weaponsList.earth = {weapon_type='regular',fireTime=0, fireRate=0.7, speed = 250, img = nil}
end
Run Code Online (Sandbox Code Playgroud)
你可以做这样的事情来访问一个子成员.
"using weaponsList,earth"
fireTime = 2
fireRate = 2
speed = 2
end
Run Code Online (Sandbox Code Playgroud)
而不是必须这样做
weaponsList.earth.fireTime = 2
weaponsList.earth.fireRate = 2
weaponsList.earth.speed = 2
Run Code Online (Sandbox Code Playgroud)
不知道这是什么叫,但我已经在C或C++中看到了.有没有办法在Lua中做到这一点,它叫什么?
lua ×1