The Lua programming language is a small scripting language specifically designed to be embedded in other programs. Lua’s C API allows exceptionally clean and simple code both to call Lua from C, and to call C from Lua. This allows developers who want a convenient runtime scripting language to easily implement the basic API elements needed by the scripting language, then use Lua code from their applications. This article introduces the Lua language as a possible tool for simplifying common development tasks, and discusses some of the reasons to embed a scripting language in the first place.
In my humble opinion, it’s really easy to make mistakes with all this stack stuff. I prefere by far use Swig (a code generator) as an intermediate layer, I’m much more productive than using the raw API.
http://www.swig.org/
I agree with the above commenter, having used Swig several times, I cannot see going and doing that kind of work by hand.
And I’d like to point out my SWIG Starter Kit that shows practical examples for how to use swig with Lua (and other languages) in a write-once export to multiple languages kind of way.
http://swigstarterkit.googlecode.com“