每次启动这个程序时,程序都会在服务器重新启动此错误后运行:
启动:13:尝试调用零
当我注释掉这一行代码时,后面和之后的行也会出现同样的情况。
直到这四条线都是。( round(math.floor)行)然后程序启动。
程序中需要这四个变量,因此它们不能很好地运行。
如果我现在取消对这些行的注释,程序就会完美地启动,并且一切都正常。
我做错什么了吗?
发布于 2015-04-14 16:31:55
函数必须在调用之前定义(round在第72行中定义,但在第5行上被调用)。您可以在定义函数之前声明它:
function program()
local round -- forward declaration
while true do
-- call function defined below
turbEnergy = round(math.floor(turbine.getEnergyStored())/100000,1)
-- function definition
function round(val, decimal)
endhttps://stackoverflow.com/questions/29630373
复制相似问题