Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我最近在 Lua 中遇到一个错误,说不能分配“?”的算术值。然后我意识到我需要定义我的数组中有多少存储空间并将它们分配给一个值,
这给了我错误:locator = {}
locator = {}
这工作得很好:locator = {0,0,0,0,0,0,0,0,0,0}
locator = {0,0,0,0,0,0,0,0,0,0}
所以现在我有另一个数组,我需要一个循环来在其中存储 200 个值,那么如何在其中定义存储和值而不需要这样的东西:a = {0,0,0,0,0,.... .. ETC}
有任何想法吗 ?
这对我有用:
locator = {} for i = 1, 200 do locator[i] = 0 end
只是在循环中将 all 分配给 0 在使用它们之前
致谢:Egor Skriptunoff