lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Yes I had that. But I will run it again.

On 8/15/2012 10:43 AM, Robert G. Jakabosky wrote:
On Tuesday 14, Digital wrote:
Well the "data" var lets say is simply a picture or file alike from
io.open("file.dat","rb"); etc ...
io.open() returns a file "object" not the contents of the file.  The file
object is a userdata value that hold a "FILE *" pointer.

-- open binary file
local file = io.open("file.dat", "rb")
-- read file contents
local data = file:read("*a") -- '*a' means read the whole file.
file:close()

-- pass binary data to 'testfunc'
local somevar = require "modulename"
somevar.testfunc(data)