所以我的 lua 脚本显示了双重结果:
它应该只显示每种流体中的一种。
这是脚本的一部分:
function firstToUpper(str)
return (str:gsub("^%l", string.upper))
end
function dispTanks()
mon.setCursorPos(offsetPos, 1)
mon2.setCursorPos(offsetPos,1)
for i=1, #machines do
-- RC Tanks --------------------------------------------
if string.find(machines[i], "rcirontankvalvetile")
or string.find(machines[i], "rcsteeltankvalvetile") then
if peripheral.isPresent(machines[i]) then
periph = peripheral.wrap(machines[i])
fluidRaw, fluidName, fluidAmount, fluidCapacity, fluidID = marik.getTank(periph)
if fluidName == nil then
-- does not display empty tanks
elseif fluidName ~= nil then
mon2.setTextColor(tc)
x,y = mon2.getCursorPos()
mon2.setCursorPos(offsetPos, (y+1))
mon2.clearLine()
-- marik.cString(offsetPos,(y+1), tc, right, ",")
nameFL = firstToUpper(marik.comma(fluidName):match("[^.]*"))
mon2.write("Tank (" .. nameFL .. ") : " .. marik.getBuckets(fluidAmount) .. " buckets")
end
end
end
end
end
我虽然不是以“,”来结束演出。或“)”,但似乎并非如此。我怎样才能解决这个问题?
Pastebin编辑 这是2个完整的代码:
- 主程序: http: //pastebin.com/ejVPwW4Q
- api: http: //pastebin.com/uycrzMTy