Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

how to save to a file lua

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #save #file #lua
ADD COMMENT
Topic
Name
1+5 =