📄 all.h
字号:
#ifndef _LUA_ALL_H
#define _LUA_ALL_H
/**
* @defgroup lua Lua C++ wrapper for scripting support
*
* Very simple to use Lua wrapper for C++ integration.
* Provides support for one-line C++ method registration
* and one-line Lua function call. For usage example
* see source/lua/test.cpp (=unit test of Lua library).
* For brief introduction to Lua, see docs/lua.pdf document.
*
* Minimal usage example:
*
\verbatim
In myclass.lua ---------------------------
function f( x )
print( "x+x=" .. add(x,x) )
end
In MyClass.cpp ---------------------------
#include <lua/LuaState.h>
#include <lua/LuaObject.h>
class MyClass : public lua::LuaObject
{
public:
float add( float a, float b )
{
return a+b;
}
MyClass( LuaState* luastate ) :
LuaObject( luastate )
{
// after this call, add(a,b) can be used from Lua script:
registerMethod( "add", this, &MyClass::add );
}
};
int main()
{
P(LuaState) luastate = new LuaState;
P(MyClass) myobj = new MyClass( luastate );
FileInputStream in( "myclass.lua" );
luastate->compile( &in, in.available(), in.toString(), myobj );
// executes the function in Lua script:
myobj->call( "f", 3.f );
}
\endverbatim
*
*
* @{
*/
#include <lua/LuaException.h>
#include <lua/LuaStackRestore.h>
#include <lua/LuaState.h>
#include <lua/LuaTable.h>
/** @} */
#endif // _LUA_ALL_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -