lua-users home
lua-l archive

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


PS when I run it as "somevar:testfunc(data)" it says "string expected, got table".

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 = "" -- 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.