[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Calling C++ class methods from lua ?
- From: Ville Sulko <vms@...>
- Date: Wed, 14 Jun 2000 16:47:53 +0300
Hi!
I am working on a project needing some sort of except-like scripting
facilities, and while looking for existing embeddable scripting
languages I ran into lua. While not providing directly all the
functionality I need, I found the language itself just about
perfect for my needs (multiple independent states and easily
extensible, just to name two of my personal favorities).
However, since the project is begin implemented in C++ and having
multiple threads (some of which would contain lua intepreter), I was
wondering what would be the best method for accessing C++ objects'
methods from the lua code? Do I have to pass the objects this-pointer
to the lua code as userdata and then write static wrappers in the C++
class which take the userdata as an argument and then call the
method of the given object (with parsed as given)?
Would further study of internals of lua reveal a better way to do
the same thing for me? I don't yet fully understand the concept of
upvals and tag methods (especially when interacting with C/C++), but
could they be used to implement something similar?
-Ville