0

我做了一个调试功能,仅在程序在调试模式下运行时才输出,但由于某种原因,它根本不起作用。

function debug{...}
  if bDebug then --bDebug is whether the program is in debug mode. It's set to true.
    for i,v in ipairs(arg) do
      print("[DEBUG] "..v)
    end
  end
end

这是程序的输出:

fireflyGLASS v0.1 alpha
Initializing classes...
1/5 Initialized 'box'
...
5/5 Initialized 'playerSurface'

我有一行代码说,debug("Running in debug mode.")但那里没有任何地方说。

有人可以告诉我发生了什么吗?

4

1 回答 1

0

等待!我想到了。

原来我是在我初始化local bDebug之后才初始化debug()的,这让lua很生气。

于 2016-07-12T02:07:23.720 回答