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)



Message: 8
Date: Mon, 14 Dec 2009 23:46:40 +0000
From: liam mail <>
Subject: Re: first email, Re: Lua C++ Binding...
To: Lua list <>
Content-Type: text/plain; charset="iso-8859-1"

2009/12/14 Joe Andresen <>

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
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...

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.