File class, available in: Global contextProvides read/write access to the filesystem. Can be used in the experiment definition to save the experiment state (onExpSave) or any other information. Files are created in the "data/scripts_output" subdirectory, which is either near the Framsticks executable (if this subdirectory is writable) or in your user Documents directory.This class has 32 members:
sdleiF
int EOF RO0 .. 1 (false/true)End Of File?
string infoInformation
string name ROName
string path ROFull path
string pathseparator ROPath separator: / or \
File stdin ROStandard input
File stdout ROStandard output
snoitcnuF
function append(string filename, string description)returns File Append buffered to the file
function appendDirect(string filename, string description)returns File Append unbuffered to the disk fileReturns null if the file can't be appended
function callURL(string url, untyped post_data_or_null, FunctionReference callback_or_null)returns Dictionary
function close()returns stringClose the fileReturns file contents if it has been buffered.
function create(string filename, string description)returns FileCreate a new buffered file
function createDirect(string filename, string description)returns FileCreate a new unbuffered disk fileReturns null if the file can't be created
function exists()returns intTest if a file existsSample:
File.exists("walking.gen") -> returns 0 or 1.
function flush()doesn't return a valueFlushUseful for unbuffered disk files only (openDirect, appendDirect)
function getContents(string filename)returns stringGet file contentsShortcut to: var f=File.open(filename); c=f.readUntilEOF(); f.close(); return c;
function new()returns File Create a new memory file
function newFromString(string text)returns File Create a new memory file with string contents
function open(string filename)returns File Open existing file for readingReturns null if the file can't be read
function readLine()returns stringRead lineReturns the next line read from file or null when there are no more lines.
function readObject(object)doesn't return a valueRead object
function readUntilEOF()returns stringRead everything
function writeComment(string anything)doesn't return a valueWrite comment string
function writeNameObject(string name, object)doesn't return a valueWrite object with an alternative name
function writeObject(object)doesn't return a valueWrite object
function writeObjectBegin(object)doesn't return a valueWrite object header
function writeObjectEnd()doesn't return a valueFinish object
function writeObjectField(object, untyped field_index_or_name)doesn't return a valueWrite single field
function writeObjectFieldForce(object, untyped field_index_or_name)doesn't return a valueWrite single field
function writeObjectFields(object)doesn't return a valueWrite all fields
function writeObjectFieldsForce(object)doesn't return a valueWrite all fields
function writeString(untyped anything)doesn't return a valueWrite anything
Global context