lua-users home
lua-l archive

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



On 7 April 2014 09:36, Moose <moose@posteo.de> wrote: 
All this messing around with lightuserdata. The name itself... I don't know. Isn't that a standard use case for an embedded language to use things outside? Wouldn't it be better to offer one function that exposes the pointer inside the script and call it push_pointer() or some such understandable way? The three lines that do the trick in my example above say to me "I'm using that mechanism called lightuserdata although this is meant for something else."

Light-userdata IS for pushing pointers :)
They are a special case of userdata, which is pushing memory.

The difference being that identical pointers (lightuserdata) compare equal; 
while userdata (memory) holding the same data, does not. 
(at least not without a metamethod, and even then they won't hash the same).
 
Also, please let me add a tad criticism. When I look at the wiki page for language bindings ( http://lua-users.org/wiki/BindingCodeToLua ) I see no less than 22 projects and mechanisms that bind C++ for use inside Lua.
A usually good side effect of having no 'blessed' implementation.
This should suggest to you that binding C++ is not an easy task, and there is no 'one size fits all' solution.

Selene has shown a small amount of promise lately (it's a new project); but it makes use of new C++11 features, which your compiler is lacking.
 
After filtering out the projects that are dead, unmaintained
Sadly our wiki is not as maintained as it used to be :(
 
or require an own library and therefore link dependency
I'm not sure why that is a problem for you...
 
Does the Lua community pursue any efforts in centralizing those projects
Yes, every now and again we give it a try, but it's like herding cats :)
 
and perhaps boil them down for direct inclusion into the distribution? Or maybe recommend one?
Lua itself has been very purposefully kept as minimal as possible: you may see fighting over in another thread right now about if including hyperbolic math functions in the standard library is too much..

On the other hand, there has been much work done on distribution of lua libraries: 
luarocks has been good lately, while on windows luadist is slowing filling that void.