www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Lua 5.1.3 bindings with wrapper classes and mixins released

reply Matthias Walter <Matthias.Walter st.ovgu.de> writes:
I'd like to announce the release of my Lua 5.1.3 bindings, which come with the
following features, making Lua-interfacing really easy with D:

* Wrapper classes for lua_State and lua_Buffer make interfacing in OOP style an
elegant thing.
* LuaObject classes represent the lua native datatypes and let you save/load
them easily to binary streams to save your data or send it over the network
* Safe lua calls are now exception-safe! This was by now impossible, due to
Luas use of the longjmp() function family.
* Support for stack- and function-traces for better debugging.
* Processing of output is variable via delegates
* Wrapping of D classes in lua with a per-state registration of specific
functionality of the class is possible via mixins. On the one hand, one can
create arbitrary Lua objects in D classes, but on the other hand let lua
programs create and work on D objects as well.

best regards
Matthias Walter
Aug 02 2008
next sibling parent reply "Koroskin Denis" <2korden gmail.com> writes:
On Sun, 03 Aug 2008 00:45:49 +0400, Matthias Walter  
<Matthias.Walter st.ovgu.de> wrote:

 I'd like to announce the release of my Lua 5.1.3 bindings, which come  
 with the following features, making Lua-interfacing really easy with D:

 * Wrapper classes for lua_State and lua_Buffer make interfacing in OOP  
 style an elegant thing.
 * LuaObject classes represent the lua native datatypes and let you  
 save/load them easily to binary streams to save your data or send it  
 over the network
 * Safe lua calls are now exception-safe! This was by now impossible, due  
 to Luas use of the longjmp() function family.
 * Support for stack- and function-traces for better debugging.
 * Processing of output is variable via delegates
 * Wrapping of D classes in lua with a per-state registration of specific  
 functionality of the class is possible via mixins. On the one hand, one  
 can create arbitrary Lua objects in D classes, but on the other hand let  
 lua programs create and work on D objects as well.

 best regards
 Matthias Walter
Really nice! Where can we get it?
Aug 02 2008
parent Matthias Walter <Matthias.Walter st.ovgu.de> writes:
Koroskin Denis Wrote:

 On Sun, 03 Aug 2008 00:45:49 +0400, Matthias Walter  
 <Matthias.Walter st.ovgu.de> wrote:
 
 I'd like to announce the release of my Lua 5.1.3 bindings, which come  
 with the following features, making Lua-interfacing really easy with D:

 * Wrapper classes for lua_State and lua_Buffer make interfacing in OOP  
 style an elegant thing.
 * LuaObject classes represent the lua native datatypes and let you  
 save/load them easily to binary streams to save your data or send it  
 over the network
 * Safe lua calls are now exception-safe! This was by now impossible, due  
 to Luas use of the longjmp() function family.
 * Support for stack- and function-traces for better debugging.
 * Processing of output is variable via delegates
 * Wrapping of D classes in lua with a per-state registration of specific  
 functionality of the class is possible via mixins. On the one hand, one  
 can create arbitrary Lua objects in D classes, but on the other hand let  
 lua programs create and work on D objects as well.

 best regards
 Matthias Walter
Really nice! Where can we get it?
Damn, I always forget to put a link.... It's under dsource/bindingns so you can svn checkout from http://svn.dsource.org/projects/bindings/trunk/lua I'm going to upload a zip file, too. It will be linked one the bindings page on dsource then.
Aug 03 2008
prev sibling next sibling parent reply yidabu <yidabu.spam gmail.com> writes:
On Sat, 02 Aug 2008 16:45:49 -0400
Matthias Walter <Matthias.Walter st.ovgu.de> wrote:

 I'd like to announce the release of my Lua 5.1.3 bindings, which come with the
following features, making Lua-interfacing really easy with D:
 
 * Wrapper classes for lua_State and lua_Buffer make interfacing in OOP style
an elegant thing.
 * LuaObject classes represent the lua native datatypes and let you save/load
them easily to binary streams to save your data or send it over the network
 * Safe lua calls are now exception-safe! This was by now impossible, due to
Luas use of the longjmp() function family.
 * Support for stack- and function-traces for better debugging.
 * Processing of output is variable via delegates
 * Wrapping of D classes in lua with a per-state registration of specific
functionality of the class is possible via mixins. On the one hand, one can
create arbitrary Lua objects in D classes, but on the other hand let lua
programs create and work on D objects as well.
 
 best regards
 Matthias Walter
any examples of usage? -- yidabu <yidabu.spam gmail.com> http://www.dsource.org/projects/dwin D ÓïÑÔ-ÖÐÎÄ(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/
Aug 04 2008
parent Matthias Walter <Matthias.Walter st.ovgu.de> writes:
yidabu Wrote:

 On Sat, 02 Aug 2008 16:45:49 -0400
 Matthias Walter <Matthias.Walter st.ovgu.de> wrote:
 
 I'd like to announce the release of my Lua 5.1.3 bindings, which come with the
following features, making Lua-interfacing really easy with D:
 
 * Wrapper classes for lua_State and lua_Buffer make interfacing in OOP style
an elegant thing.
 * LuaObject classes represent the lua native datatypes and let you save/load
them easily to binary streams to save your data or send it over the network
 * Safe lua calls are now exception-safe! This was by now impossible, due to
Luas use of the longjmp() function family.
 * Support for stack- and function-traces for better debugging.
 * Processing of output is variable via delegates
 * Wrapping of D classes in lua with a per-state registration of specific
functionality of the class is possible via mixins. On the one hand, one can
create arbitrary Lua objects in D classes, but on the other hand let lua
programs create and work on D objects as well.
 
 best regards
 Matthias Walter
any examples of usage? -- yidabu <yidabu.spam gmail.com> http://www.dsource.org/projects/dwin D ÓïÑÔ-ÖÐÎÄ(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/
The code is very well documented, also with examples. But I'll put some on the site at dsource: http://dsource.org/projects/bindings/wiki/LuaLib best regards Matthias Walter
Aug 04 2008
prev sibling parent reply Dejan Lekic <dejan.lekic tiscali.co.uk> writes:
Mr. Walter, what are advantages of this binding over the DLUA project? 
More about it: http://code.google.com/p/dlua/ .

Kind regards
Sep 09 2008
parent reply Matthias Walter <Matthias.Walter st.ovgu.de> writes:
Dejan Lekic Wrote:

 Mr. Walter, what are advantages of this binding over the DLUA project? 
 More about it: http://code.google.com/p/dlua/ .
 
 Kind regards
To clarify, what we talk about: It's the current version of Lua in the bindings project (http://dsource.org/projects/bindings/wiki/LuaLib). I'll give a short list of features: 1. You have OOP wrappers for LuaState and LuaBuffer. This is more a style feature for all those of us that like OOP. But this enables some other featuers, as you will see. 2. The wrappers can be used with more D-ish datatypes like char[] instead of \0-terminated arrays. 3. One might register functions and methods to a given LuaState, which makes them available in Lua, if they return int and take a LuaState. Also constructors may be registered, but of course they should not return int :) The registrations are done via D code mixins. At runtime, one can wrap a class, which makes the LuaState push a userdata, representing this class, onto the stack of this state. So the D-Object is now also available in D. If a constructor is registered, this works vice versa, so Lua code might create D objects, too. Such an object in Lua will have all the methods (via metatables) which were registered before, so you can easily backend your Lua datastructures in D. 4. All lua native types can be saved in special D objects which make them serializable. If you want to send Lua runtime data over the wire by your Lua client, one can easily dump a whole table with all its data. 5. Have you ever tried to raise an exception in a C or D function, which was called by Lua code? Normally, you'll get a segfault, because error handling is done va getjmp and longjmp internally by the lua library which breakes exception handling in D. My Lua wrappers will catch exceptions, add some information, where it was caught, save everything, let the library longjmp and raise it again. In my lib, this is called exception forwarding. I hope this illustrates some advantages of the OOP approach. best regards Matthias Walter
Sep 09 2008
next sibling parent Hoenir <mrmocool gmx.de> writes:
Finally someone made 5.1.3 bindings, thank you!
That OOP stuff sounds good, will test it :)
Sep 11 2008
prev sibling parent reply Hoenir <mrmocool gmx.de> writes:
Just a question, which environment is this supposed to be compiled in?
Seems to focused on Tango, is it meant for D2.0?
Sep 11 2008
parent reply Matthias Walter <Matthias.Walter st.ovgu.de> writes:
Hoenir Wrote:

 Just a question, which environment is this supposed to be compiled in?
 Seems to focused on Tango, is it meant for D2.0?
No, it's not meant for D 2.0. But you are right, that it's based on Tango. If you have problems ( maybe + solutions) for use with phobos, a hint or patch is welcome! best regards Matthias Walter
Sep 12 2008
parent Hoenir <mrmocool web.de> writes:
Matthias Walter Wrote:
 No, it's not meant for D 2.0. But you are right, that it's based on Tango. If
you have problems ( maybe + solutions) for use with phobos, a hint or patch is
welcome!
Well indeed there are problems with Phobos, already fixed some.
Sep 12 2008