lua-users home
lua-l archive

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



  8. Re: first email, Re: Lua C++ Binding... (liam mail)

e/lua/attachments/20091214/ec57e8c2/attachment-0001.html

------------------------------

Message: 8
Date: Mon, 14 Dec 2009 23:46:40 +0000
From: liam mail <liam.list@googlemail.com>
Subject: Re: first email, Re: Lua C++ Binding...
To: Lua list <lua@bazar2.conectiva.com.br>
Message-ID:
       <173d86e00912141546j549ca8efp2c1139bf9fe53b84@mail.gmail.com">173d86e00912141546j549ca8efp2c1139bf9fe53b84@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

2009/12/14 Joe Andresen <joe.andresen@gmail.com>


I feel it is a matter of weighing the pros and cons of every feasible way of
integrating two languages.
The method you describe is perfectly valid and is used and recommended in
publications, yet also has cons.
To me bindings do more than just bind classes they may also:
Provide generic methods for calling Lua methods.
Provide generic means of passing parameters to Lua.
Error check.
Provide generic methods as a default for storing, accessing and adding to
tables.
Ease integration of the Languages.
Decouple the scripting language used allowing for others to be easily
swapped in.
Decouple the language from core code, if required.
Provide compile time checks on your code.
Provide unit tests so you are sure they do the correct thing.
Provide extending C++ classes in Lua.
Provide overriding C++ member functions in Lua.
Provide operator usage via metamethods.

To me the method you suggest improves the speed of calling C++ from Lua, yet
increases debugging and integration time.

PS. How do I reply to the message properly...?
Do you mean ethically should you bottom post or how to click the reply
button :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://bazar2.conectiva.com.br/mailman/private/lua/attachments/20091214/ca4f92e9/attachment-0001.html


Thanks for the reply,

I was getting the messages in digest mode so I wasn't sure the best way to reply.
Not anymore though.

I would agree with all of your points except for the debugging. I have used the decoda debugger for my system
and it works quite well, i can also debug the c++ functions that support lua fairly easily. The hash table system
is the only place that calls "new" in the entire engine during runtime, so any memory leaks can be found around there.

To me its more of an architecture thing, i dont want the lua programmer to have to use a bunch of types to get what he wants,
he should just have to deal with game objects and what he wants to do with them.

I think that pointers could be used in this way, but i didn't manage to go down that path.