lua-users home
lua-l archive

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


Thank you very much for this information.  It's amazing how simple this
really is.
I'm strongly in favour of having a sample program that demonstrates this, or
an example in the manual that describes (as simply as you did) the use of
userdata.

I have one more question:

> A cleaner solution would be to create a single global variable in Lua,
> called "C" for clarity, and then talk with your C host via the "C"
variable,
> which woud contain a table and have appropriate get/settable tag methods.
> So, in your Lua code, you could write
>	C.twkHeightFactor=1.2
> or
> 	print(C.twkHeightFactor)
>
>(perhaps "C" should be called "twk" instead, in this case).
What would the tag methods look like in this case?   Maybe another example
would be helpful  :-)

Though this is "cleaner" due to its encapsulation, I think the direct
pointer
example is extremely elegant and makes the lua files look very simple for 
designers.  

> I hope you get the idea. If there is demand, I can write a simple Lua
program
> that reads simple C declarations of variables to be exported and outputs
> the necessary code; a sort of bare bones tolua.
> I'll also talk with Waldemar about changing tolua to use this scheme
instead of
> creating 2 functions for each variable. 
Both of these suggestions are great!  Would it be possible for tolua to give
more
informative error messages?  I.e. indication of what exactly is causing
parse 
errors, rather than just printing out the string it was reading when the
parse
error occured...

Thank you very much for all your help!
Falko