diff --git a/projectfiles/VC12/liblua.vcxproj b/projectfiles/VC12/liblua.vcxproj index 2a3a790c0eb..5c7e7fc054a 100644 --- a/projectfiles/VC12/liblua.vcxproj +++ b/projectfiles/VC12/liblua.vcxproj @@ -164,7 +164,6 @@ - @@ -207,7 +206,6 @@ - diff --git a/projectfiles/VC12/liblua.vcxproj.filters b/projectfiles/VC12/liblua.vcxproj.filters index 36c1d095f38..3f6dc54fb5a 100644 --- a/projectfiles/VC12/liblua.vcxproj.filters +++ b/projectfiles/VC12/liblua.vcxproj.filters @@ -50,9 +50,6 @@ Source Files - - Source Files - Source Files @@ -175,9 +172,6 @@ Header Files - - Header Files - Header Files diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 449f4c293cd..51f2eb2a5c0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -331,7 +331,6 @@ set(libwesnoth-lua_STAT_SRC lua/ltablib.cpp lua/lstrlib.cpp lua/loadlib.cpp - lua/linit.cpp lua/lutf8lib.cpp ) # We explicitly want lua compiled as C++ version, so this line is required: diff --git a/src/lua/SConscript b/src/lua/SConscript index 6af2cfd232d..1d1640226cc 100644 --- a/src/lua/SConscript +++ b/src/lua/SConscript @@ -33,7 +33,6 @@ loslib.cpp ltablib.cpp lstrlib.cpp loadlib.cpp -linit.cpp lutf8lib.cpp """) env_lua = env.Clone( diff --git a/src/lua/linit.cpp b/src/lua/linit.cpp deleted file mode 100644 index 8ce94ccb355..00000000000 --- a/src/lua/linit.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* -** $Id: linit.c,v 1.38 2015/01/05 13:48:33 roberto Exp $ -** Initialization of libraries for lua.c and other clients -** See Copyright Notice in lua.h -*/ - - -#define linit_c -#define LUA_LIB - -/* -** If you embed Lua in your program and need to open the standard -** libraries, call luaL_openlibs in your program. If you need a -** different set of libraries, copy this file to your project and edit -** it to suit your needs. -** -** You can also *preload* libraries, so that a later 'require' can -** open the library, which is already linked to the application. -** For that, do the following code: -** -** luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); -** lua_pushcfunction(L, luaopen_modname); -** lua_setfield(L, -2, modname); -** lua_pop(L, 1); // remove _PRELOAD table -*/ - -#include "lprefix.h" - - -#include - -#include "lua.h" - -#include "lualib.h" -#include "lauxlib.h" - - -/* -** these libs are loaded by lua.c and are readily available to any Lua -** program -*/ -static const luaL_Reg loadedlibs[] = { - {"_G", luaopen_base}, - {LUA_LOADLIBNAME, luaopen_package}, - {LUA_COLIBNAME, luaopen_coroutine}, - {LUA_TABLIBNAME, luaopen_table}, - {LUA_IOLIBNAME, luaopen_io}, - {LUA_OSLIBNAME, luaopen_os}, - {LUA_STRLIBNAME, luaopen_string}, - {LUA_MATHLIBNAME, luaopen_math}, - {LUA_UTF8LIBNAME, luaopen_utf8}, - {LUA_DBLIBNAME, luaopen_debug}, -#if defined(LUA_COMPAT_BITLIB) - {LUA_BITLIBNAME, luaopen_bit32}, -#endif - {NULL, NULL} -}; - - -LUALIB_API void luaL_openlibs (lua_State *L) { - const luaL_Reg *lib; - /* "require" functions from 'loadedlibs' and set results to global table */ - for (lib = loadedlibs; lib->func; lib++) { - luaL_requiref(L, lib->name, lib->func, 1); - lua_pop(L, 1); /* remove lib */ - } -} - diff --git a/src/lua/lua.hpp b/src/lua/lua.hpp deleted file mode 100644 index ec417f59469..00000000000 --- a/src/lua/lua.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// lua.hpp -// Lua header files for C++ -// <> not supplied automatically because Lua also compiles as C++ - -extern "C" { -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" -} diff --git a/src/wesnoth_lua_config.md b/src/wesnoth_lua_config.md index 332f545452a..3a62e67cc74 100644 --- a/src/wesnoth_lua_config.md +++ b/src/wesnoth_lua_config.md @@ -42,8 +42,10 @@ Change into the Lua source folder. $ cd ~/lua-5.3.3/src We do not need, or want, the Lua command line interpreter, the Lua compiler or the Makefile, so delete them. +We compile using C++ so cannot allow the use of "C" linkage from the provided header. +And we initialize the Lua runtime and do not want to allow the provided initialization routine. - $ rm lua.c luac.c Makefile + $ rm lua.c luac.c Makefile lua.hpp linit.c Wesnoth requires all Lua sources to be compiled using C++. To ensure this, rather than depend upon compiler flags, rename the files.