lua-users home
lua-l archive

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

On 7 October 2011 21:05, Patrick Rapin <> wrote:
>  - Do you run Lua scripts from within a C or C++ application ?
>  - If yes, what API are you using for it?

I call the Lua C API from C++, with a very small number of utility
functions to compact common patterns down to one call.

I'm normally quite 'pro' C++ (RAII, strings, STL, functors, exceptions
etc), but I like the Lua C API the way it is.  The stack model makes
sense to me.  I agree that it was a bit of a shock at first to see how
many function calls were needed on the C side to get anything done,
but I can't imagine how any of them could be removed and still keep
the current flexibility.

Also, the Lua C api is clearly and *precisely* documented by the
reference manual.  Every function states exactly what arguments it
expects, what it does to the stack, who is responsible for memory,

Peter Pimley