From b6e02cc049da29cdf90615a875bf1f59da1f824c Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Fri, 1 Jun 2012 17:47:43 +0200 Subject: [PATCH] lua:Change the print destination. game: all basics access between elements --- Sources/libetk/etk/Debug.cpp | 5 + Sources/libetk/etk/Debug.h | 15 +- Sources/libetk/etk/Stream.h | 186 ++++------- Sources/libewol/ewol/Game/GameElement.h | 3 +- Sources/libewol/ewol/Game/GameElementLua.cpp | 299 +++++++++++++++++- Sources/libewol/ewol/Game/SceneElement.cpp | 4 + Sources/libewol/ewol/base/guiX11.cpp | 21 +- Sources/liblua/Android.mk | 2 +- Sources/liblua/Linux.mk | 2 +- Sources/liblua/file.mk | 64 ++-- Sources/liblua/lua/{lapi.c => lapi.cpp} | 0 Sources/liblua/lua/{lauxlib.c => lauxlib.cpp} | 0 .../liblua/lua/{lbaselib.c => lbaselib.cpp} | 24 ++ Sources/liblua/lua/{lbitlib.c => lbitlib.cpp} | 0 Sources/liblua/lua/{lcode.c => lcode.cpp} | 0 .../liblua/lua/{lcorolib.c => lcorolib.cpp} | 0 Sources/liblua/lua/{lctype.c => lctype.cpp} | 0 Sources/liblua/lua/{ldblib.c => ldblib.cpp} | 0 Sources/liblua/lua/{ldebug.c => ldebug.cpp} | 0 Sources/liblua/lua/{ldo.c => ldo.cpp} | 29 +- Sources/liblua/lua/{ldump.c => ldump.cpp} | 0 Sources/liblua/lua/{lfunc.c => lfunc.cpp} | 0 Sources/liblua/lua/{lgc.c => lgc.cpp} | 0 Sources/liblua/lua/{linit.c => linit.cpp} | 0 Sources/liblua/lua/{liolib.c => liolib.cpp} | 0 Sources/liblua/lua/{llex.c => llex.cpp} | 0 .../liblua/lua/{lmathlib.c => lmathlib.cpp} | 0 Sources/liblua/lua/{lmem.c => lmem.cpp} | 0 Sources/liblua/lua/{loadlib.c => loadlib.cpp} | 0 Sources/liblua/lua/{lobject.c => lobject.cpp} | 0 .../liblua/lua/{lopcodes.c => lopcodes.cpp} | 0 Sources/liblua/lua/{loslib.c => loslib.cpp} | 0 Sources/liblua/lua/{lparser.c => lparser.cpp} | 0 Sources/liblua/lua/{lstate.c => lstate.cpp} | 0 Sources/liblua/lua/{lstring.c => lstring.cpp} | 0 Sources/liblua/lua/{lstrlib.c => lstrlib.cpp} | 0 Sources/liblua/lua/{ltable.c => ltable.cpp} | 0 Sources/liblua/lua/{ltablib.c => ltablib.cpp} | 0 Sources/liblua/lua/{ltm.c => ltm.cpp} | 0 Sources/liblua/lua/lua.hpp | 3 +- Sources/liblua/lua/{lundump.c => lundump.cpp} | 0 Sources/liblua/lua/{lvm.c => lvm.cpp} | 0 Sources/liblua/lua/{lzio.c => lzio.cpp} | 0 43 files changed, 449 insertions(+), 208 deletions(-) rename Sources/liblua/lua/{lapi.c => lapi.cpp} (100%) rename Sources/liblua/lua/{lauxlib.c => lauxlib.cpp} (100%) rename Sources/liblua/lua/{lbaselib.c => lbaselib.cpp} (94%) rename Sources/liblua/lua/{lbitlib.c => lbitlib.cpp} (100%) rename Sources/liblua/lua/{lcode.c => lcode.cpp} (100%) rename Sources/liblua/lua/{lcorolib.c => lcorolib.cpp} (100%) rename Sources/liblua/lua/{lctype.c => lctype.cpp} (100%) rename Sources/liblua/lua/{ldblib.c => ldblib.cpp} (100%) rename Sources/liblua/lua/{ldebug.c => ldebug.cpp} (100%) rename Sources/liblua/lua/{ldo.c => ldo.cpp} (96%) rename Sources/liblua/lua/{ldump.c => ldump.cpp} (100%) rename Sources/liblua/lua/{lfunc.c => lfunc.cpp} (100%) rename Sources/liblua/lua/{lgc.c => lgc.cpp} (100%) rename Sources/liblua/lua/{linit.c => linit.cpp} (100%) rename Sources/liblua/lua/{liolib.c => liolib.cpp} (100%) rename Sources/liblua/lua/{llex.c => llex.cpp} (100%) rename Sources/liblua/lua/{lmathlib.c => lmathlib.cpp} (100%) rename Sources/liblua/lua/{lmem.c => lmem.cpp} (100%) rename Sources/liblua/lua/{loadlib.c => loadlib.cpp} (100%) rename Sources/liblua/lua/{lobject.c => lobject.cpp} (100%) rename Sources/liblua/lua/{lopcodes.c => lopcodes.cpp} (100%) rename Sources/liblua/lua/{loslib.c => loslib.cpp} (100%) rename Sources/liblua/lua/{lparser.c => lparser.cpp} (100%) rename Sources/liblua/lua/{lstate.c => lstate.cpp} (100%) rename Sources/liblua/lua/{lstring.c => lstring.cpp} (100%) rename Sources/liblua/lua/{lstrlib.c => lstrlib.cpp} (100%) rename Sources/liblua/lua/{ltable.c => ltable.cpp} (100%) rename Sources/liblua/lua/{ltablib.c => ltablib.cpp} (100%) rename Sources/liblua/lua/{ltm.c => ltm.cpp} (100%) rename Sources/liblua/lua/{lundump.c => lundump.cpp} (100%) rename Sources/liblua/lua/{lvm.c => lvm.cpp} (100%) rename Sources/liblua/lua/{lzio.c => lzio.cpp} (100%) diff --git a/Sources/libetk/etk/Debug.cpp b/Sources/libetk/etk/Debug.cpp index 00401512..b0f93b66 100644 --- a/Sources/libetk/etk/Debug.cpp +++ b/Sources/libetk/etk/Debug.cpp @@ -72,3 +72,8 @@ void TOOLS_DisplayTime(void) etk::cout << tmpdata ; } + +etk::logLevel_te g_requestedLevel = etk::LOG_LEVEL_ERROR; +void GeneralDebugSetLevel(etk::logLevel_te ccc) { + g_requestedLevel = ccc; +} \ No newline at end of file diff --git a/Sources/libetk/etk/Debug.h b/Sources/libetk/etk/Debug.h index 686535f2..879c927b 100644 --- a/Sources/libetk/etk/Debug.h +++ b/Sources/libetk/etk/Debug.h @@ -36,12 +36,17 @@ void TOOLS_DisplayTime(void); #undef __class__ #define __class__ (NULL) +extern etk::logLevel_te g_requestedLevel; +void GeneralDebugSetLevel(etk::logLevel_te ccc); + #define ETK_DBG_COMMON(libName, info, data) do { \ - etk::cout << etk::cstart << info; \ - TOOLS_DisplayTime(); \ - TOOLS_DisplayFuncName(__LINE__, __class__, __func__, libName); \ - etk::cout << data; \ - etk::cout < * tmpSprite = NULL; static etk::VectorType * tmpEffects = NULL; static ewol::SceneElement * tmpScene = NULL; +template int index(lua_State* L); + +template <> int index(lua_State* L) +{ + bool* ptr = (bool*)lua_touserdata(L, 1); + lua_pushboolean(L, *ptr ? 1 : 0); + return 1; +} + +template <> int index(lua_State* L) +{ + float* ptr = (float*)lua_touserdata(L, 1); + lua_pushnumber(L, *ptr); + return 1; +} + +template int newindex(lua_State* L); + +template <> int newindex(lua_State* L) +{ + bool* ptr = (bool*)lua_touserdata(L, 1); + *ptr = lua_toboolean(L, 3)!=0; + return 0; +} + +template <> int newindex(lua_State* L) +{ + float* ptr = (float*)lua_touserdata(L, 1); + if (!lua_isnumber(L, 3)) { + return luaL_error(L, "new value must be a number"); + } + *ptr = (float)lua_tonumber(L, 3); + return 1; +} + +template class LuaValue +{ + private: + lua_State* L; + etk::UString name; + T* ptr; + public: + LuaValue(lua_State* _L, etk::UString _name) + : L(_L), name(_name), ptr(0) + { + ptr = (T*)lua_newuserdata(L, sizeof(T)); + *ptr = T(); + lua_createtable(L, 0, 2); + lua_pushcfunction(L, index); + lua_setfield(L, -2, "__index"); + lua_pushcfunction(L, newindex); + lua_setfield(L, -2, "__newindex"); + lua_setmetatable(L, -2); + lua_setglobal(L, name.Utf8Data()); + } + virtual ~LuaValue(void) + { + lua_pushnil(L); + lua_setglobal(L, name.Utf8Data()); + ptr = 0; + L = 0; + } + LuaValue& operator=(const T& value) { *ptr = value; return *this; } + operator T() { return *ptr; } +}; + + +/* +template <> int lua_Set(lua_State* L) +{ + if (NULL==tmpObj) { + EWOL_ERROR("NULL obj..."); + lua_pushnumber(L, 0 ); + return 1; + } + etkFloat_t value = luaL_checknumber(L, 1); + tmpObj->AngleSet(value); + // return number of parameters + return 1; +} + + +template <> int lua_Get(lua_State* L) +{ + if (NULL==tmpObj) { + EWOL_ERROR("NULL obj..."); + lua_pushnumber(L, 0 ); + return 1; + } + etkFloat_t value = tmpObj->AngleGet(); + lua_pushnumber(L, value ); + // return number of parameters + return 1; +} +*/ LUAMOD_API int lua_GetPos(lua_State *L) { @@ -153,6 +248,33 @@ LUAMOD_API int lua_SetAngle(lua_State *L) return 1; } + +LUAMOD_API int lua_GetSize(lua_State *L) +{ + if (NULL==tmpObj) { + EWOL_ERROR("NULL obj..."); + lua_pushnumber(L, 0 ); + return 1; + } + etkFloat_t value = tmpObj->SizeGet(); + lua_pushnumber(L, value ); + // return number of parameters + return 1; +} + +LUAMOD_API int lua_SetSize(lua_State *L) +{ + if (NULL==tmpObj) { + EWOL_ERROR("NULL obj..."); + lua_pushnumber(L, 0 ); + return 1; + } + etkFloat_t value = luaL_checknumber(L, 1); + tmpObj->SizeSet(value); + // return number of parameters + return 1; +} + LUAMOD_API int lua_SpriteLoad(lua_State *L) { //LUA : int SpriteLoad("fileName", maxSize); => -1 in error ... @@ -267,6 +389,30 @@ LUAMOD_API int lua_ElementSetPos(lua_State *L) return 0; } +LUAMOD_API int lua_ElementGetPos(lua_State *L) +{ + //LUA : ElementSetPos(newElementId, posX, posY); + if (NULL==tmpScene) { + EWOL_ERROR("ploppp "); + lua_pushnumber(L, (lua_Number)0 ); + lua_pushnumber(L, (lua_Number)0 ); + return 2; + } + int32_t idElement = luaL_checkint(L, 1); + ewol::GameElement* tmpElem = tmpScene->GetElement(idElement); + if (NULL != tmpElem) { + coord2D_ts tmpPos = tmpElem->PositionGet(); + lua_pushnumber(L, (lua_Number)tmpPos.x ); + lua_pushnumber(L, (lua_Number)tmpPos.y ); + } else { + lua_pushnumber(L, (lua_Number)0.0 ); + lua_pushnumber(L, (lua_Number)0.0 ); + EWOL_ERROR("Get element unique ID : " << idElement); + } + // return number of parameters + return 2; +} + LUAMOD_API int lua_ElementSetPower(lua_State *L) { //LUA : ElementSetPower(newElementId, 1); @@ -301,6 +447,100 @@ LUAMOD_API int lua_ElementSetAngle(lua_State *L) return 1; } + +LUAMOD_API int lua_GetNearestEnemy(lua_State *L) +{ + //LUA : int GetNearestEnemy() + if (NULL==tmpScene || NULL==tmpObj) { + EWOL_ERROR("NULL obj..."); + lua_pushinteger(L, 0 ); + return 1; + } + uint32_t elementId = tmpScene->GetNearestEnemy(tmpObj->PositionGet(), tmpObj->GroupGet()); + if (0==elementId) { + EWOL_ERROR("Error getting enemy ..."); + } + lua_pushinteger(L, elementId ); + // return number of parameters + return 1; +} + +LUAMOD_API int lua_ElmentExisted(lua_State *L) +{ + //LUA : ElementSetPos(newElementId, posX, posY); + if (NULL==tmpScene) { + EWOL_ERROR("NULL obj..."); + lua_pushboolean(L, false ); + return 1; + } + int32_t idElement = luaL_checkint(L, 1); + if (0 != idElement) { + ewol::GameElement* tmpElem = tmpScene->GetElement(idElement); + if (NULL != tmpElem) { + lua_pushboolean(L, true ); + } else { + lua_pushboolean(L, false ); + } + } else { + lua_pushboolean(L, false ); + } + // return number of parameters + return 1; +} + +LUAMOD_API int lua_HaveImpact(lua_State *L) +{ + //LUA : ElementSetPos(newElementId, posX, posY); + if (NULL==tmpScene || NULL==tmpObj) { + EWOL_ERROR("NULL obj..."); + lua_pushboolean(L, false ); + return 1; + } + + // TODO : Remove this when find an other way do do it ... + ewol::GameElementLua * ttmpObj = tmpObj; + etk::VectorType * ttmpSprite = tmpSprite; + etk::VectorType * ttmpEffects = tmpEffects; + ewol::SceneElement * ttmpScene = tmpScene; + + bool result = tmpScene->HaveImpact(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), tmpObj->SizeGet()); + + tmpObj = ttmpObj; + tmpSprite = ttmpSprite; + tmpEffects = ttmpEffects; + tmpScene = ttmpScene; + + lua_pushboolean(L, result ); + // return number of parameters + return 1; +} + +LUAMOD_API int lua_Explosion(lua_State *L) +{ + //LUA : ElementSetPos(newElementId, posX, posY); + if (NULL==tmpScene || NULL==tmpObj) { + EWOL_ERROR("NULL obj..."); + return 0; + } + + // TODO : Remove this when find an other way do do it ... + ewol::GameElementLua * ttmpObj = tmpObj; + etk::VectorType * ttmpSprite = tmpSprite; + etk::VectorType * ttmpEffects = tmpEffects; + ewol::SceneElement * ttmpScene = tmpScene; + + tmpScene->Explosion(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), 0.01, tmpObj->PowerGet()); + + tmpObj = ttmpObj; + tmpSprite = ttmpSprite; + tmpEffects = ttmpEffects; + tmpScene = ttmpScene; + + // return number of parameters + return 0; +} + + static const luaL_Reg functionsTable[] = { // local element section { "GetPos", lua_GetPos }, @@ -308,14 +548,21 @@ static const luaL_Reg functionsTable[] = { { "GetSpeed", lua_GetSpeed }, { "SetSpeed", lua_SetSpeed }, { "GetAngle", lua_GetAngle }, - { "SetAngle", lua_GetAngle }, + { "SetAngle", lua_SetAngle }, + { "GetSize", lua_GetSize }, + { "SetSize", lua_SetSize }, { "GetPower", lua_GetPower }, - { "SetPower", lua_GetPower }, + { "SetPower", lua_SetPower }, // other element section { "ElementAdd", lua_ElementAdd }, + { "ElementExisted", lua_ElmentExisted }, { "ElementSetPos", lua_ElementSetPos }, + { "ElementGetPos", lua_ElementGetPos }, { "ElementSetPower", lua_ElementSetPower }, { "ElementSetAngle", lua_ElementSetAngle }, + { "GetNearestEnemy", lua_GetNearestEnemy }, + { "HaveImpact", lua_HaveImpact }, + { "Explosion", lua_Explosion }, // Sprite section { "SpriteLoad", lua_SpriteLoad }, { "SpriteUnLoad", lua_SpriteUnLoad }, @@ -341,6 +588,7 @@ ewol::GameElementLua::GameElementLua(ewol::SceneElement & sceneElement, etk::USt ewol::GameElement(sceneElement, tmpName), m_luaState(NULL) { + m_group = group; tmpObj = this; tmpScene = &m_sceneElement; etk::File fileElement(tmpName, etk::FILE_TYPE_DATA); @@ -355,7 +603,12 @@ ewol::GameElementLua::GameElementLua(ewol::SceneElement & sceneElement, etk::USt luaL_openlibs(m_luaState); // open internal specific elements ... luaopen_myLib(m_luaState); - +/* + LuaValue *myBool = new LuaValue(m_luaState, "m_testBool"); + LuaValue *myValue = new LuaValue(m_luaState, "m_testFloat"); + *myBool = false; + *myValue = 18; +*/ int32_t fileSize = fileElement.Size(); if (0==fileSize) { EWOL_ERROR("This file is empty : " << fileElement); @@ -404,6 +657,9 @@ ewol::GameElementLua::GameElementLua(ewol::SceneElement & sceneElement, etk::USt return; } } +/* + EWOL_INFO("retreave element : " << *myValue << " and : " << *myBool); +*/ tmpObj = NULL; tmpScene = NULL; } @@ -494,14 +750,26 @@ void ewol::GameElementLua::Draw(etk::VectorType & listOfSprite, e bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, coord2D_ts position, etkFloat_t size) { - //HaveImpact(group, type, posX, posY, size) + // todo set a flag that permit lua to direct control of this ... + + // check if it was in the same group + if (group == m_group) { + return false; + } + etkFloat_t quadDistance = quadDist(m_position, position); + etkFloat_t radiusElement = m_size * m_size; + if (radiusElement < quadDistance) { + //distance is greten than expected + return false; + } + //HaveImpact(group, type, posX, posY, size, quadDistance) tmpObj = this; - bool retVal = false; + bool retVal = true; if (NULL != m_luaState) { // call the init function - lua_getglobal(m_luaState, "Process"); + lua_getglobal(m_luaState, "HaveImpact"); if(!lua_isfunction(m_luaState,-1)) { - EWOL_WARNING("LUA: Not Find 'Process' function "); + EWOL_VERBOSE("LUA: Not Find 'HaveImpact' function "); lua_pop(m_luaState,1); } else { lua_pushnumber(m_luaState, group); @@ -509,8 +777,9 @@ bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, coord2D_ts po lua_pushnumber(m_luaState, position.x); lua_pushnumber(m_luaState, position.y); lua_pushnumber(m_luaState, size); - // do the call (5 arguments, 1 result) - if (lua_pcall(m_luaState, 5, 1, 0) != 0) { + lua_pushnumber(m_luaState, quadDistance); + // do the call (6 arguments, 1 result) + if (lua_pcall(m_luaState, 6, 1, 0) != 0) { EWOL_ERROR("LUA: error running function 'Process':" << lua_tostring(m_luaState, -1)); } else { // retrieve result @@ -534,9 +803,9 @@ void ewol::GameElementLua::Explosion(int32_t group, int32_t type, coord2D_ts pos tmpObj = this; if (NULL != m_luaState) { // call the init function - lua_getglobal(m_luaState, "Process"); + lua_getglobal(m_luaState, "Explosion"); if(!lua_isfunction(m_luaState,-1)) { - EWOL_WARNING("LUA: Not Find 'Process' function "); + EWOL_VERBOSE("LUA: Not Find 'Explosion' function "); lua_pop(m_luaState,1); } else { lua_pushnumber(m_luaState, group); @@ -545,9 +814,11 @@ void ewol::GameElementLua::Explosion(int32_t group, int32_t type, coord2D_ts pos lua_pushnumber(m_luaState, position.y); lua_pushnumber(m_luaState, pxAtenuation); lua_pushnumber(m_luaState, power); - // do the call (6 arguments, 0 result) - if (lua_pcall(m_luaState, 6, 0, 0) != 0) { - EWOL_ERROR("LUA: error running function 'Process':" << lua_tostring(m_luaState, -1)); + etkFloat_t quadDistance = quadDist(m_position, position); + lua_pushnumber(m_luaState, quadDistance); + // do the call (7 arguments, 0 result) + if (lua_pcall(m_luaState, 7, 0, 0) != 0) { + EWOL_ERROR("LUA: error running function 'Explosion':" << lua_tostring(m_luaState, -1)); } } } diff --git a/Sources/libewol/ewol/Game/SceneElement.cpp b/Sources/libewol/ewol/Game/SceneElement.cpp index 639039d8..ec777bfd 100644 --- a/Sources/libewol/ewol/Game/SceneElement.cpp +++ b/Sources/libewol/ewol/Game/SceneElement.cpp @@ -114,6 +114,10 @@ uint32_t ewol::SceneElement::GetNearestEnemy(coord2D_ts position, int32_t groupI uint32_t result = 0; etkFloat_t lastQuadDistance = 9999999999999999.0; int32_t jjj=0; + if (groupId <0 || groupId >= MAX_GROUP_NUMBER) { + EWOL_ERROR("incorect group number : " << groupId); + return 0; + } while (groupEnemy[groupId][jjj] != -1) { for (int32_t iii=0; iii static int luaB_print (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ int i; + #if 0 + // oudside etk : lua_getglobal(L, "tostring"); for (i=1; i<=n; i++) { const char *s; @@ -39,6 +42,27 @@ static int luaB_print (lua_State *L) { lua_pop(L, 1); /* pop result */ } luai_writeline(); + #else + lua_getglobal(L, "tostring"); + etk::cout << etk::cstart << etk::LOG_LEVEL_INFO; + TOOLS_DisplayTime(); + TOOLS_DisplayFuncName(__LINE__, __class__, __func__, "luaFile "); + for (i=1; i<=n; i++) { + const char *s; + size_t l; + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + s = lua_tolstring(L, -1, &l); /* get result */ + if (s == NULL) { + return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("print")); + } + if (i>1) etk::cout << "\t"; + etk::cout << s; + lua_pop(L, 1); /* pop result */ + } + etk::cout <status == 0) (c)->status = -1; } -#define luai_jmpbuf int /* dummy variable */ - -#elif defined(LUA_USE_ULONGJMP) -/* in Unix, try _longjmp/_setjmp (more efficient) */ -#define LUAI_THROW(L,c) _longjmp((c)->b, 1) -#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } -#define luai_jmpbuf jmp_buf - -#else /* default handling with long jumps */ #define LUAI_THROW(L,c) longjmp((c)->b, 1) #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } #define luai_jmpbuf jmp_buf -#endif - -#endif @@ -128,9 +103,7 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { lj.status = LUA_OK; lj.previous = L->errorJmp; /* chain new error handler */ L->errorJmp = &lj; - LUAI_TRY(L, &lj, - (*f)(L, ud); - ); + LUAI_TRY(L, &lj, (*f)(L, ud); ); L->errorJmp = lj.previous; /* restore old error handler */ L->nCcalls = oldnCcalls; return lj.status; diff --git a/Sources/liblua/lua/ldump.c b/Sources/liblua/lua/ldump.cpp similarity index 100% rename from Sources/liblua/lua/ldump.c rename to Sources/liblua/lua/ldump.cpp diff --git a/Sources/liblua/lua/lfunc.c b/Sources/liblua/lua/lfunc.cpp similarity index 100% rename from Sources/liblua/lua/lfunc.c rename to Sources/liblua/lua/lfunc.cpp diff --git a/Sources/liblua/lua/lgc.c b/Sources/liblua/lua/lgc.cpp similarity index 100% rename from Sources/liblua/lua/lgc.c rename to Sources/liblua/lua/lgc.cpp diff --git a/Sources/liblua/lua/linit.c b/Sources/liblua/lua/linit.cpp similarity index 100% rename from Sources/liblua/lua/linit.c rename to Sources/liblua/lua/linit.cpp diff --git a/Sources/liblua/lua/liolib.c b/Sources/liblua/lua/liolib.cpp similarity index 100% rename from Sources/liblua/lua/liolib.c rename to Sources/liblua/lua/liolib.cpp diff --git a/Sources/liblua/lua/llex.c b/Sources/liblua/lua/llex.cpp similarity index 100% rename from Sources/liblua/lua/llex.c rename to Sources/liblua/lua/llex.cpp diff --git a/Sources/liblua/lua/lmathlib.c b/Sources/liblua/lua/lmathlib.cpp similarity index 100% rename from Sources/liblua/lua/lmathlib.c rename to Sources/liblua/lua/lmathlib.cpp diff --git a/Sources/liblua/lua/lmem.c b/Sources/liblua/lua/lmem.cpp similarity index 100% rename from Sources/liblua/lua/lmem.c rename to Sources/liblua/lua/lmem.cpp diff --git a/Sources/liblua/lua/loadlib.c b/Sources/liblua/lua/loadlib.cpp similarity index 100% rename from Sources/liblua/lua/loadlib.c rename to Sources/liblua/lua/loadlib.cpp diff --git a/Sources/liblua/lua/lobject.c b/Sources/liblua/lua/lobject.cpp similarity index 100% rename from Sources/liblua/lua/lobject.c rename to Sources/liblua/lua/lobject.cpp diff --git a/Sources/liblua/lua/lopcodes.c b/Sources/liblua/lua/lopcodes.cpp similarity index 100% rename from Sources/liblua/lua/lopcodes.c rename to Sources/liblua/lua/lopcodes.cpp diff --git a/Sources/liblua/lua/loslib.c b/Sources/liblua/lua/loslib.cpp similarity index 100% rename from Sources/liblua/lua/loslib.c rename to Sources/liblua/lua/loslib.cpp diff --git a/Sources/liblua/lua/lparser.c b/Sources/liblua/lua/lparser.cpp similarity index 100% rename from Sources/liblua/lua/lparser.c rename to Sources/liblua/lua/lparser.cpp diff --git a/Sources/liblua/lua/lstate.c b/Sources/liblua/lua/lstate.cpp similarity index 100% rename from Sources/liblua/lua/lstate.c rename to Sources/liblua/lua/lstate.cpp diff --git a/Sources/liblua/lua/lstring.c b/Sources/liblua/lua/lstring.cpp similarity index 100% rename from Sources/liblua/lua/lstring.c rename to Sources/liblua/lua/lstring.cpp diff --git a/Sources/liblua/lua/lstrlib.c b/Sources/liblua/lua/lstrlib.cpp similarity index 100% rename from Sources/liblua/lua/lstrlib.c rename to Sources/liblua/lua/lstrlib.cpp diff --git a/Sources/liblua/lua/ltable.c b/Sources/liblua/lua/ltable.cpp similarity index 100% rename from Sources/liblua/lua/ltable.c rename to Sources/liblua/lua/ltable.cpp diff --git a/Sources/liblua/lua/ltablib.c b/Sources/liblua/lua/ltablib.cpp similarity index 100% rename from Sources/liblua/lua/ltablib.c rename to Sources/liblua/lua/ltablib.cpp diff --git a/Sources/liblua/lua/ltm.c b/Sources/liblua/lua/ltm.cpp similarity index 100% rename from Sources/liblua/lua/ltm.c rename to Sources/liblua/lua/ltm.cpp diff --git a/Sources/liblua/lua/lua.hpp b/Sources/liblua/lua/lua.hpp index 4f9c28b7..70e9e202 100644 --- a/Sources/liblua/lua/lua.hpp +++ b/Sources/liblua/lua/lua.hpp @@ -2,8 +2,7 @@ // Lua header files for C++ // <> not supplied automatically because Lua also compiles as C++ -extern "C" { #include "lua/lua.h" #include "lua/lualib.h" #include "lua/lauxlib.h" -} + diff --git a/Sources/liblua/lua/lundump.c b/Sources/liblua/lua/lundump.cpp similarity index 100% rename from Sources/liblua/lua/lundump.c rename to Sources/liblua/lua/lundump.cpp diff --git a/Sources/liblua/lua/lvm.c b/Sources/liblua/lua/lvm.cpp similarity index 100% rename from Sources/liblua/lua/lvm.c rename to Sources/liblua/lua/lvm.cpp diff --git a/Sources/liblua/lua/lzio.c b/Sources/liblua/lua/lzio.cpp similarity index 100% rename from Sources/liblua/lua/lzio.c rename to Sources/liblua/lua/lzio.cpp