string¶
Used to interact with text files.
function setup()
local contentsOrNil = string.read(asset.."Hello.txt")
print("Contents: " .. tostring(contentsOrNil))
if test == "World" then
string.save(asset.."Hello.txt", "Hello")
else
string.save(asset.."Hello.txt", "World")
end
end
- string.read(assetKey)¶
Reads the contents of a file as text.
- Parameters:
assetKey (
assetKey
) – The asset key of the file.- Returns:
The contents of the file.
- Return type: