📜  如何保存到文件 lua 代码示例

📅  最后修改于: 2022-03-11 14:54:55.053000             🧑  作者: Mango

代码示例1
function saveHighScore(score)
    print("High score: "..tostring(score))
    local file,err = io.open("high_score.txt",'w')
    if file then
        file:write(tostring(score))
        file:close()
    else
        print("error:", err) -- not so hard?
    end
end