📄 oasisscriptluainterpreter.h
字号:
/******************************************************************************
* This source file is part of Bad Camel Gaming
* Copyright (C) 2003 Zephie Greyvenstein
* See Readme.html for acknowledgements
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/******************************************************************************
* FILENAME : oasisScriptLuaInterpreter.h
* DESCRIPTION : This is for calling lua functions from C/C++. Do not use
this class directly, use ScriptSystem.
* AUTHOR : Gaw (garcia@cs.ttu.edu)
*****************************************************************************/
/// Avoid double inclusion
#ifndef __LUASCRIPTINTERPRETER_H__
#define __LUASCRIPTINTERPRETER_H__
#include <vector>
/// Include common stuff
#include "oasisCommon.h"
/// Include the rest of the needed oasis stuff
#include "oasisScriptInterpreter.h"
namespace Oasis {
//Lua powered interpreter
class _oasisExport scriptLuaInterpreter : public scriptInterpreter {
public:
/// Constructor
scriptLuaInterpreter( );
/// Destructor
virtual ~scriptLuaInterpreter( );
bool executeScript( string &name );
void *executeString( string &name, uint8 &type );
void reset( );
void *convertFromC( void *cObject, uint8 type );
void *convertToC( void *scriptObject, uint8 &type );
void *callFunction( string &name, string &types,
void **arguments, uint8 &returntype);
void freeVariable( void *script_var );
//This is a workaround for toLua/C. In order to initialize a
//module, you must call this with the tolua_<module>_open( L )
//function. Otherwise scripting wouldn't be extendable!
void loadLibrary( int ( *callback )( lua_State * ) );
private:
lua_State *luaInterpreter;
//This is the actual conversion function (it just pushes arguments
//onto the luaInterpreter stack).
void _convertFromC( void *cObject, uint8 type );
//Load the default libraries
void loadLibs( );
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -