我开始在 ZeroBrane Studio 中使用 Project / Analyze 来进行 Marmalade Quick 项目,我发现让我直接了解全局和本地范围非常有用。
不过,这是一个烦恼:它指向库 - 基本上 - 作为未定义的全局变量:
.../resources/main.lua(11): first use of unknown global variable 'system'
.../resources/main.lua(12): first use of unknown global variable 'json'
.../resources/main.lua(13): first use of unknown global variable 'device'
.../resources/main.lua(14): first use of unknown global variable 'physics'
.../resources/main.lua(15): first use of unknown global variable 'color'
.../resources/main.lua(16): first use of unknown global variable 'director'
.../resources/main.lua(17): first use of unknown global variable 'key'
有没有办法抑制库(或特定变量名)的警告?
作为部分步骤,我开始将它放在文件开头 - 它不能解决投诉,只是将它们提升到顶部:
local system = system
local json = json
local device = device
local physics = physics
local color = color
local director = director
local key = key
顺便说一句,这是否会影响性能?看来我正在将 global 转换director
为 local director
,理论上更快...