小编Ste*_*flf的帖子

消除Lua中表的前缀

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
推荐指数
1
解决办法
68
查看次数

标签 统计

lua ×1