lua-users home
lua-l archive

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

> -----Original Message-----
> From: [mailto:lua-
>] On Behalf Of Paul Beckingham
> Sent: Wednesday, December 30, 2009 8:47 AM
> To:
> Subject: Embedding Lua in an application
> Option 2)
> The product passes a handle to the Lua script.  The product then
> implements a series of functions that the Lua can call, to get more
> data, modify data.
> Pro: Minimal initial data transfer, marshaling on demand
> Con: ?

The con is the time it takes to implement all the object accessor/modifier functions that the Lua-called functions will need.  In my experience though it ends up being a lot of copy-and-paste, and about half of that is just making sure your C functions exported to Lua have a proper argument set.

> I'm leaning towards option 2, but maybe there is a third I'm not aware
> of.  Does anyone have any advice on "the Lua way" to do this?

I did what you're calling option 2.  Works like a charm, and easily extensible if I need to add more functions on either side of the line.