file
AppVar access. file and storage are one library under two
names: the same methods, with the same error handling, on every
target, the Flash App backend included.
from ti84 import file
file.create("SAVE", 4)
file.write_u16("SAVE", 0, 1000)
total = file.read_u16("SAVE", 0)
Values are stored low byte first. On classic, a value of 32768 or more reads back as a negative number, because integers are signed 16-bit.
Methods
- exists(name) bool
Whether an AppVar exists.
- Targets:
CE, Classic, Flash App
z = file.exists('SAVE')
- size(name) int
An AppVar’s size in bytes, or 0 if missing.
- Targets:
CE, Classic, Flash App
z = file.size('SAVE')
- create(name, size)
Create a zero-filled AppVar unless it already exists.
- Targets:
CE, Classic, Flash App
file.create('SAVE', x)
- delete(name)
Delete an AppVar if it exists.
- Targets:
CE, Classic, Flash App
file.delete('SAVE')
- clear(name)
Zero every byte of an AppVar.
- Targets:
CE, Classic, Flash App
file.clear('SAVE')
- read_byte(name, offset) int
Read a byte.
- Targets:
CE, Classic, Flash App
z = file.read_byte('SAVE', x)
- write_byte(name, offset, value)
Write a byte.
- Targets:
CE, Classic, Flash App
file.write_byte('SAVE', x, y)
- read_u16(name, offset) int
Read a little-endian 16-bit value.
- Targets:
CE, Classic, Flash App
z = file.read_u16('SAVE', x)
- write_u16(name, offset, value)
Write a little-endian 16-bit value.
- Targets:
CE, Classic, Flash App
file.write_u16('SAVE', x, y)