バイナリファイルから読み書きしようとしています。私はこのチュートリアルに従ってきましたが、動作します... txt ファイルに何かを書き込んでいるように見えることを除いて。テストの際にtest.binというファイル名を付けたのですが、メモ帳でも開けてちゃんと表示できるので、実際にはバイナリファイルではないと思います。「wb」と「rb」のバイナリファイルだと言いましたよね?
if arg[1] == "write" then
local output = assert(io.open(arg[2], "wb"))
output:write(arg[3]) --3rd argument is written to the file.
assert(output:close())
elseif arg[1] == "read" then
local input = assert(io.open(arg[2], "rb"))
print(input:read(1)) --Should read one byte, not one char/int. Right?
end