www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Best Lua integration?

reply Kim <kimo73 example.com> writes:
Hello

what is the best Lua integration available?

I have found these two so far:
* https://github.com/JakobOvrum/LuaD (only Lua 5.1)
* https://github.com/DerelictOrg/DerelictLua (Lua 5.3)

The former seems better/more active. Are there other similar 
projects that I am missing?

Thanks
Nov 16 2016
next sibling parent Mike Parker <aldacron gmail.com> writes:
On Wednesday, 16 November 2016 at 22:53:46 UTC, Kim wrote:
 Hello

 what is the best Lua integration available?

 I have found these two so far:
 * https://github.com/JakobOvrum/LuaD (only Lua 5.1)
 * https://github.com/DerelictOrg/DerelictLua (Lua 5.3)

 The former seems better/more active. Are there other similar 
 projects that I am missing?

 Thanks
I can't speak for LuaD, but DerelictLua should be perfectly usable. Don't let the lack of activity scare you. It's a binding, the sort of thing that's implemented once and forgotten about except for bug fixes and updates. I updated it earlier this year for Lua 5.3. If people report issues, I'll fix them.
Nov 16 2016
prev sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 17/11/2016 11:53 AM, Kim wrote:
 Hello

 what is the best Lua integration available?

 I have found these two so far:
 * https://github.com/JakobOvrum/LuaD (only Lua 5.1)
 * https://github.com/DerelictOrg/DerelictLua (Lua 5.3)

 The former seems better/more active. Are there other similar projects
 that I am missing?

 Thanks
LuaD is a lot more then just a binding. It does have static bindings to Lua. Where as DerelictLua has dynamic bindings (linking is done at runtime to shared libraries).
Nov 16 2016
parent reply Soulsbane <paul acheronsoft.com> writes:
On Thursday, 17 November 2016 at 03:46:26 UTC, rikki cattermole 
wrote:
 On 17/11/2016 11:53 AM, Kim wrote:
 Hello

 what is the best Lua integration available?

 I have found these two so far:
 * https://github.com/JakobOvrum/LuaD (only Lua 5.1)
 * https://github.com/DerelictOrg/DerelictLua (Lua 5.3)

 The former seems better/more active. Are there other similar 
 projects
 that I am missing?

 Thanks
LuaD is a lot more then just a binding. It does have static bindings to Lua. Where as DerelictLua has dynamic bindings (linking is done at runtime to shared libraries).
Not to mention much more high level(LuaD).
Nov 16 2016
parent reply Kim <kimo73 example.com> writes:
On Thursday, 17 November 2016 at 04:54:02 UTC, Soulsbane wrote:
 On Thursday, 17 November 2016 at 03:46:26 UTC, rikki cattermole 
 wrote:
 On 17/11/2016 11:53 AM, Kim wrote:
 Hello

 what is the best Lua integration available?

 I have found these two so far:
 * https://github.com/JakobOvrum/LuaD (only Lua 5.1)
 * https://github.com/DerelictOrg/DerelictLua (Lua 5.3)

 The former seems better/more active. Are there other similar 
 projects
 that I am missing?

 Thanks
LuaD is a lot more then just a binding. It does have static bindings to Lua. Where as DerelictLua has dynamic bindings (linking is done at runtime to shared libraries).
Not to mention much more high level(LuaD).
Yes I see the higher level as a weakness. It may save you time to integrate in D, but tries to hide complexity. Hiding complexity can hurt in other ways. I think I will go for the more C-like binding of DerelictLua; I am fine for the shared libraries binding as I don't need static bindings, but I guess that could be added without too much effort?
Nov 16 2016
next sibling parent Mike Parker <aldacron gmail.com> writes:
On Thursday, 17 November 2016 at 06:33:06 UTC, Kim wrote:

 I think I will go for the more C-like binding of DerelictLua; I 
 am fine for the shared libraries binding as I don't need static 
 bindings, but I guess that could be added without too much 
 effort?
Some of the Derelict bindings already support a static configuration. I intend to add one to DerelictLua in the very near future. I've got a little tool that can convert Derelict-style function pointer declarations into standard function declarations for a static binding, so yeah, it's easy to do.
Nov 16 2016
prev sibling next sibling parent Chris <wendlec tcd.ie> writes:
On Thursday, 17 November 2016 at 06:33:06 UTC, Kim wrote:
 Yes I see the higher level as a weakness. It may save you time 
 to integrate in D, but tries to hide complexity. Hiding 
 complexity can hurt in other ways.

 I think I will go for the more C-like binding of DerelictLua; I 
 am fine for the shared libraries binding as I don't need static 
 bindings, but I guess that could be added without too much 
 effort?
I've worked with both. I prefer DerelictLua, because you have more direct control. But be prepared to deal with Lua stacks and its C API, which can be a bit annoying at times. You'll probably start writing you own D wrappers for convenience (that's where D's templates shine) and end up with something like LuaD - which makes you appreciate LuaD even more.
Nov 17 2016
prev sibling parent Jesse Phillips <Jesse.K.Phillips+D gmail.com> writes:
On Thursday, 17 November 2016 at 06:33:06 UTC, Kim wrote:
 Yes I see the higher level as a weakness. It may save you time 
 to integrate in D, but tries to hide complexity. Hiding 
 complexity can hurt in other ways.

 I think I will go for the more C-like binding of DerelictLua; I 
 am fine for the shared libraries binding as I don't need static 
 bindings, but I guess that could be added without too much 
 effort?
For your desires Derelict sounds like the best option. I definitely recommend LuaD though. I'm not sure what complexity your concerned about hiding, you're trying to interface with a dynamic language, LuaD provides "high level" functions which handle adding and removing D/Lua objects from the Lua stack and interacting with Lua objects directly. You should still be able to manipulate Lua through the C API, I just don't know why you'd want to put yourself through that.
Nov 17 2016