AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
00001 // 00002 // 00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine 00004 // 00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk 00006 // 00007 // For updates, tutorials and more details check out www.appeasymobile.com 00008 // 00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin. 00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support 00011 // 00012 // 00013 00014 #if !defined(_CZ_SCRIPT_LUA_H_) 00015 #define _CZ_SCRIPT_LUA_H_ 00016 00017 #include "CzScript.h" 00018 00019 // LUA headers 00020 extern "C" 00021 { 00022 #include "lua.h" 00023 #include "lstate.h" 00024 #include "lauxlib.h" 00025 #include "lualib.h" 00026 } 00027 00028 /** 00029 @class CzScriptEngineLua 00030 00031 @brief LUA script engine. 00032 00033 */ 00034 00035 class CzScriptEngineLua : public IzScriptEngine 00036 { 00037 public: 00038 // Proprties 00039 protected: 00040 lua_State* Lua; ///< The lua engines state 00041 public: 00042 lua_State* getState() { return Lua; } 00043 // Properties end 00044 00045 protected: 00046 public: 00047 00048 CzScriptEngineLua() : IzScriptEngine(), Lua(NULL) {} 00049 virtual ~CzScriptEngineLua() 00050 { 00051 Release(); 00052 } 00053 00054 int Init(CzScene* scene); 00055 void Release(); 00056 int LoadScript(const char* script, int script_len, const char* name); 00057 int CallFunction(IzXomlResource* object, CzString* function_name, CzString* param1, CzString* param2, CzString* param3); 00058 CzXomlProperty getVariable(CzString* var_name); 00059 int CallFunctionRef(int function_ref, CzString* param1, CzString* param2, CzString* param3, CzString* param4); 00060 int CallFunctionRefWithObject(void* object, int function_ref, CzString* param1, CzString* param2, CzString* param3, CzString* param4); 00061 CzString getType() { return CzString("lua"); } 00062 00063 00064 static void DisplayError(lua_State *lua, const char* message); 00065 static void DisplayError(lua_State *lua, const char* message, const char* data); 00066 00067 // Internal 00068 }; 00069 00070 00071 00072 00073 #endif // _CZ_SCRIPT_LUA_H_