Lua: Updating parts of a file hex-editor-style
snippet in lua

Lua: Updating parts of a file hex-editor-style

user2566

~$ cat > test.dat
It's cold outside.
~$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> f = io.open('test.dat', 'r+')
> f:seek("set", 5)
> f:write("warm")
> f:close()
>
~$ cat test.dat
It's warm outside.
~$