Difference between revisions of "Lua:createFileStream"
Jump to navigation
Jump to search
(Initial page creation.) |
m (Added related function template.) |
||
| Line 25: | Line 25: | ||
===Examples=== | ===Examples=== | ||
| − | < | + | <syntaxhighlight lang="lua" line> |
local stream = createFileStream("C:\\Temp\\output.bin", fmCreate) | local stream = createFileStream("C:\\Temp\\output.bin", fmCreate) | ||
stream.writeByte(0x42) | stream.writeByte(0x42) | ||
stream.destroy() | stream.destroy() | ||
| − | </ | + | </syntaxhighlight> |
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
| + | |||
| + | {{Creation}} | ||
Latest revision as of 23:54, 26 June 2026
Creates a stream backed by a file.
Use fmCreate, fmOpenRead, fmOpenWrite, or fmOpenReadWrite as the base mode. Sharing flags can be combined with the mode.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| filename | String | Path of the file to create or open. |
| mode | Integer | File mode constant, optionally combined with a sharing flag. |
Returns[edit]
FileStream — The opened file stream.
Examples[edit]
1 local stream = createFileStream("C:\\Temp\\output.bin", fmCreate)
2 stream.writeByte(0x42)
3 stream.destroy()