A buffer of n zeroed bytes. Returns nil if that much memory isn't available rather than raising — asking for more than the machine has is a normal thing for a mod sizing itself to a user's settings to do, and it needs to be able to back off instead of dying.
buffer
A block of mutable bytes. Lua strings are immutable, so anything that holds a lot of data and changes it has to allocate a new copy every time — fine for a few kilobytes, ruinous for megabytes arriving sixty times a second. A Buffer is a fixed-size array you write into and overwrite in place. It is deliberately primitive: a size, a read, a write, a fill. No growth, no types, no structure — whatever a mod wants to keep in it is the mod's business.
Offsets are 0-based throughout, to match Frame. Every access is bounds-checked: a read past the end is short, a write past the end is dropped.
How many bytes it holds. Fixed for the buffer's life. Takes no parameters.
Copies len bytes out as a string, from 0-based offset from. Clamped to the end of the buffer, so a request that runs off it returns what exists.
Writes the string src at 0-based offset at. Returns how many bytes were written — less than #src if it hit the end.
Sets every byte to v (0–255).
data.append take (name, buf, from, len) as well as a string, so a slice goes to the file without being copied through Lua first.