Type [Function][ap i.type.Function] Return value [Bool ean]api.type.Boolean Revision [Release 2025.3721](https://solar2d.com/download/) Keywords steam, st eamworks, writeFile, cloud storage See also [steamwor ks.*]plugin.steamworks
This function writes data to a file in Steam Cloud storage. It returns true
if the file was successfully written, false
otherwise.
This API is only available on 2025.3722+
Steam Cloud provides automatic synchronization of save files across different devices where the user has the game installed. Files written using this function will be automatically backed up and synchronized by Steam.
The function accepts a filename and data string, and uses Steam’s Remote Storage API to write the data to the cloud.
steamworks.writeFile( filename, data )
Boolean. Returns true
if the file was successfully written to Steam Cloud, false
if the operation failed.
local steamworks = require( "plugin.steamworks" ) local json = require( "json" ) local function savePlayerData() local saveData = { level = 5, score = 12345, items = { "sword", "shield", "potion" } } local jsonData = json.encode(saveData) if steamworks.writeFile("playerData.json", jsonData) then print("Player data saved to Steam Cloud!") else print("Failed to save player data.") end end -- Call the save function savePlayerData()