I just test the simple code as follow,
local f = io.open("lua53.dll")
local str = f:read("a")
it is output is:
it only read out 201 bytes, but the file size is 230400, what is wrong here?
Windows distinguishes between text and binary files, so you need to explicitly open the file as a binary file, using io.open("lua53.dll", "rb") where the "b" in the mode specifies binary. If you don't specify binary mode, then text mode is assumed, and Lua (actually, the Windows C runtime, since Lua just delegates to that) cuts off
f:read("a") at the first byte that represents an end-of-file control code.