lua-users home
lua-l archive

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


Luna is a small generic C++ template class that binds your C++ 
classes to Lua. Allowing you to write in Lua constructs like

  a = Account{100}
  a:withdraw(50)
  b = v:balance()

where Account is a C++ class registered as 'Account', withdraw and
balance are member functions of that class registered as such.

* Just as C functions registered in Lua must have a signature of 
"int (*)(lua_State*)", member functions of Account registered in 
Lua must have a signature of "int(Account::*)(lua_State*)"

* Currently, only binding of member functions is supported. Access 
to public primitive or user-defined types are not.

* The code is typesafe, errors are caught at compile time.

* Objects created are gc'd by Lua.

* The code consists of a small header file(3.6K) just over 100 lines.

* Very easy to use. Simply create an array of member functions to 
bind and create an instance of the template class.

http://sophia.eyep.net/code/luna.tar.gz

 or

http://sophia.eyep.net/code/luna.h
http://sophia.eyep.net/code/lunatest.cc
http://sophia.eyep.net/code/lunatest.lua

Any feedback is appreciated.

Thanks,
-Lenny