lua-users home
lua-l archive

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


I'm looking at the Simple(r)Cpp Bindings on the Wiki, particularly the
Lunar bindings ("Cpp Binding With Lunar" and "Calling Lua From Cpp").
Does somebody have an example that turns these examples inside-out?
The examples mostly show how to take a C++ class (implemented in C++)
and how to use it in Lua. I'm curious about how to have that same C++
public interface, but implement some of the underlying details in Lua.

So for example, instead of having the C++ methods deposit(double),
withdraw(double), and balance() which use a C++ member variable called
m_balance, what if I wanted to have those C++ methods call Lua
functions and use Lua variables for storage? I'm also curious about
the additional case where a class method is defined in pure C++ and
those Lua functions need to call it (which makes this more
complicated).

Thank you