0

したがって、私の lua スクリプトは二重の結果を示しています。

ここに画像の説明を入力

各タイプの流体の 1 つだけを表示する必要があります。

これはスクリプトの一部です:

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 edit これは 2 つの完全なコードです。

4

1 に答える 1