1.
Io. Open (filename [, mode])
Function: open a file in the specified mode. If the file is successfully opened, the file handle is returned. If the file fails, the NIL + error message is returned.
Mode:
"R": Read mode (default );
"W": Write mode;
"A": Add mode;
2.
File: Write (...)
Function: output the file content in the specified parameter format. The parameter must be a character or number. to output other values, use tostring or string. Format for conversion.
3.
File: Close ()
Function: Close the file. I am too lazy to 'safely Delete the hardware' when I pull a USB flash drive. the same is true for this command. Lua automatically recycles garbage ........
Routine:
1 File = Io. Open ( " A.txt " , " W " ) 2 -- Open a.txt with 'write mode ', and create a file if it does not exist. 3 4 File: Write ( " Hello world. " ) 5 -- Write a string to a file 6 7 File: Close () 8 --[[ Close files, 9 I almost never write close 10 In order not to mislead you, have you written down close? 11 Does it mean that I am a good teacher? 12 ]