[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: tolua 3.0b issue
- From: Waldemar Celes <celes@...>
- Date: Mon, 08 Feb 1999 11:11:17 -0200
> // BUG REPORT:
> It appears that I may have found a bug or problem with regard to arrays in
> function parameters. For example:
> short getfileinfo(file_info *zfile,unsigned char type,unsigned char
Well, it might be a wrong design decision, but it's not a bug.
For tolua, char* represents string while
char represent array of numeric values (varying from 0 to 255).
> (The below tolua generated binding function
> has the corrections.)
The corrections you made are not correct :-(
> type[i] = ((unsigned char) tolua_getfieldstring(lo,i+1,0));
"tolua_getfieldstring" returns a char* not a char.
> I think tolua needs to consider the array type in this
Sorry, but for now I prefer to have both approaches:
string (char*) and array of bytes (char).
you can also use the lua functions "strbyte" and "strchar" to
convert from numeric array to string and vice-versa.
> More importantly, is the following the only way for tolua to recognize
> multiple return values? What I want to do is this:
> err,type,creator = getfileinfo(fi)
Yes! You can do that.
Assuming 'err' and 'type' are integers and 'creator' is a string,
you should write in the .pkg file:
int getfileinfo (file_info* fi, int* type=0, char** creator=0);
the use of default values for type and creator allows you not to
pass them when calling the function.
> Thanks again for your help. I haven't test everything about tolua yet, but
> things are progressing.
thank you for your interest in tolua. hope it can help you.