Namespaces | Defines

_src_lua_bind_lua.cc File Reference

Interface for Lua scripts. More...

#include "base/module.hh"
#include "base/singleton.hh"
#include "base/file.hh"
#include "base/stream.hh"
#include "lua_bind/module.hh"
#include "lua_bind/lua.hh"
#include "lua_bind/bind.hh"
#include "lua_bind/register.hh"

Namespaces

namespace  lua
 

Lua main namespace.


namespace  lua::interpreter
 

Lua interpreter (include "lua_bind/lua_interpreter.hh").


Defines

#define REG_FUNC_BEGIN
#define REG_FUNC_ARGS   mLua
#define REG_FUNC_END   ;
#define REG_FUNC_CMDLINE

Detailed Description

Interface for Lua scripts.

LastChangedDate:
2011-08-20 12:07:38 -0400 (Sat, 20 Aug 2011)
Author:
Jim E. Brooks http://www.palomino3d.org
Remarks:
- module.txt documents how to export new C++ classes to Lua.
  • Lua's C interface is based on a virtual stack.
  • Top-of-stack is referenced by -1.
  • When execution transitions from C++ to Lua, the C/C++ side must not overflow Lua's virtual stack, so Lua::SaveStack()/RestoreStack()/ThrowException() are used in methods that may affect Lua's stack.
  • When execution transitions from Lua to C/C++, Lua will automatically restore the virtual stack. But tracking stack items is still necessary while writing C++, since the C++ side usually has to return results to Lua via the stack.
  • Lua treats table members referenced by a numeric index (array) or string key (dictionary) separately. Thus, lua_rawgeti() or lua_getfield() must be used, resp.
  • lua_isnumber() etc will automatically convert between numbers and strings.
  • The Lua interpreter can be run in (only one) separate thread. Once that thread is spawned, the main thread cannot ever access Lua again, as two threads cannot make function calls into each other.

Define Documentation

#define REG_FUNC_ARGS   mLua
#define REG_FUNC_BEGIN
#define REG_FUNC_CMDLINE
#define REG_FUNC_END   ;
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Palomino Flight Simulator documents generated by doxygen 1.7.1 on Tue May 15 2012 22:40:10