lua-users home
lua-l archive

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


Well the "data" var lets say is simply a picture or file alike from io.open("file.dat","rb"); etc ...

"somevar" is just used to call a function from the dll. I guess it can equally be used as "modulename.testfunc()" but using "somevar" makes it easier to call functions etc. I've seen dozens of modules/packages that use it that way.

I have made several dlls this way and they always have worked fine. Never any problems. Just whenever I pass binary data it will cease to function for some reason.

On 8/15/2012 9:45 AM, Robert G. Jakabosky wrote:
On Tuesday 14, Digital wrote:
Alright, I added it.

But even before it gets to that it will error out by saying "string
expected, got userdata" ??
How are you creating the binary data?

Also be careful how you call the 'testfunc' from Lua

somevar = require "modulename"
data = "binary data" -- how is this data created?
somevar.testfunc(data) -- here it will have only one parameter: data
somevar:testfunc(data) -- here it will have two parameters: somevar & data
------------^ note the ":" instead of "."

If somevar is a userdata value then that might be why you are getting that
error.