Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/core-build-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
-I src/ \
--suppress=*:src/lualib/* \
--suppress=*:src/LuaEngine/libs/* \
--suppress=*:src/sol/* \
--output-file=report.txt \
.
if [ -s report.txt ]; then
Expand Down
88 changes: 0 additions & 88 deletions src/LuaEngine/ALECompat.cpp

This file was deleted.

47 changes: 0 additions & 47 deletions src/LuaEngine/ALECompat.h

This file was deleted.

6 changes: 1 addition & 5 deletions src/LuaEngine/ALEEventMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
#include "LuaEngine.h"
#include "Object.h"

extern "C"
{
#include "lua.h"
#include "lauxlib.h"
};
#include <sol/sol.hpp>

ALEEventProcessor::ALEEventProcessor(ALE** _E, WorldObject* _obj) : m_time(0), obj(_obj), E(_E)
{
Expand Down
2 changes: 2 additions & 0 deletions src/LuaEngine/ALEIncludes.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
#include "ArenaTeam.h"
#include "WorldSessionMgr.h"

#include <sol/sol.hpp>

typedef Opcodes OpcodesList;

/*
Expand Down
8 changes: 1 addition & 7 deletions src/LuaEngine/ALETemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@
#ifndef _ALE_TEMPLATE_H
#define _ALE_TEMPLATE_H

extern "C"
{
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
};
#include <sol/sol.hpp>
#include "LuaEngine.h"
#include "ALECompat.h"
#include "ALEUtility.h"
#include "SharedDefines.h"

Expand Down
7 changes: 1 addition & 6 deletions src/LuaEngine/BindingMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@
#include "ALEUtility.h"
#include <type_traits>

extern "C"
{
#include "lua.h"
#include "lauxlib.h"
};

#include <sol/sol.hpp>

/*
* A set of bindings from keys of type `K` to Lua references.
Expand Down
6 changes: 1 addition & 5 deletions src/LuaEngine/HttpManager.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#include <thread>
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
};
#include <sol/sol.hpp>

#define CPPHTTPLIB_OPENSSL_SUPPORT

Expand Down
15 changes: 2 additions & 13 deletions src/LuaEngine/LuaEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "LuaEngine.h"
#include "BindingMap.h"
#include "Chat.h"
#include "ALECompat.h"
#include "ALEEventMgr.h"
#include "ALEIncludes.h"
#include "ALETemplate.h"
Expand All @@ -31,16 +30,6 @@
#include <sys/stat.h>
#include <unordered_map>

extern "C"
{
// Base lua libraries
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"

// Additional lua libraries
};

ALE::ScriptList ALE::lua_scripts;
ALE::ScriptList ALE::lua_extensions;
std::string ALE::lua_folderpath;
Expand Down Expand Up @@ -446,7 +435,7 @@ bool ALE::CompileScriptToGlobalCache(const std::string& filepath)
BytecodeWriter writer;
writer.buffer = &cacheEntry.bytecode;

int dumpResult = lua_dump(tempL, BytecodeWriter::writer, &writer);
int dumpResult = lua_dump(tempL, BytecodeWriter::writer, &writer, 0);
if (dumpResult != LUA_OK || cacheEntry.bytecode.empty())
{
globalBytecodeCache.erase(filepath);
Expand Down Expand Up @@ -504,7 +493,7 @@ bool ALE::CompileMoonScriptToGlobalCache(const std::string& filepath)
BytecodeWriter writer;
writer.buffer = &cacheEntry.bytecode;

int dumpResult = lua_dump(tempL, BytecodeWriter::writer, &writer);
int dumpResult = lua_dump(tempL, BytecodeWriter::writer, &writer, 0);
if (dumpResult != LUA_OK || cacheEntry.bytecode.empty())
{
globalBytecodeCache.erase(filepath);
Expand Down
5 changes: 1 addition & 4 deletions src/LuaEngine/LuaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
#include <ctime>
#include <unordered_map>

extern "C"
{
#include <lua.h>
};
#include <sol/sol.hpp>

struct ItemTemplate;
typedef BattlegroundTypeId BattleGroundTypeId;
Expand Down
5 changes: 0 additions & 5 deletions src/LuaEngine/LuaFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Please see the included DOCS/LICENSE.md for more information
*/

extern "C"
{
#include "lua.h"
};

// ALE
#include "LuaEngine.h"
#include "ALEEventMgr.h"
Expand Down
4 changes: 2 additions & 2 deletions src/LuaEngine/lmarshal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <stdlib.h>
#include <string.h>
#include <cstdint>
#include "ALECompat.h"
#include "lmarshal.h"

#if LUA_VERSION_NUM == 501 && !defined(luaL_setfuncs)
#define luaL_setfuncs(L, l, n) luaL_register(L, NULL, l)
Expand Down Expand Up @@ -218,7 +218,7 @@ static void mar_encode_value(lua_State *L, mar_Buffer *buf, int val, size_t *idx

lua_pushvalue(L, -1);
buf_init(L, &rec_buf);
lua_dump(L, (lua_Writer)buf_write, &rec_buf);
lua_dump(L, (lua_Writer)buf_write, &rec_buf, 0);

buf_write(L, (const char*)&tag, MAR_CHR, buf);
buf_write(L, (const char*)&rec_buf.head, MAR_I32, buf);
Expand Down
4 changes: 1 addition & 3 deletions src/LuaEngine/lmarshal.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
* Please see the included DOCS/LICENSE.md for more information
*/

extern "C" {
#include "lua.h"
}
#include <sol/sol.hpp>

int mar_encode(lua_State* L);
int mar_decode(lua_State* L);
28 changes: 24 additions & 4 deletions src/lualib/lua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,18 @@ elseif (UNIX)
set_target_properties(lualib PROPERTIES OUTPUT_NAME ${LUA_VERSION})
endif()

add_executable(lua_interpreter ${LUA_SOURCE_FOLDER}/lua.c)
target_link_libraries(lua_interpreter lualib)
if (LUA_STATIC)
add_executable(lua_interpreter ${LUA_SOURCE_FOLDER}/lua.c)
target_link_libraries(lua_interpreter lualib)
else()
add_executable(lua_interpreter ${LUA_SOURCE_FOLDER}/lua.c ${LOCAL_SOURCES_C})
target_include_directories(lua_interpreter PRIVATE "${LUA_SOURCE_FOLDER}")
if(APPLE)
target_link_libraries(lua_interpreter readline)
else()
target_link_libraries(lua_interpreter m ${CMAKE_DL_LIBS})
endif()
endif()
target_compile_definitions(lua_interpreter PRIVATE _CRT_SECURE_NO_WARNINGS)
if (NOT WIN32)
target_compile_options(lua_interpreter PRIVATE -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
Expand All @@ -129,8 +139,18 @@ else()
install(TARGETS lua_interpreter DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
endif()

add_executable(lua_compiler ${LUA_SOURCE_FOLDER}/luac.c)
target_link_libraries(lua_compiler lualib)
if (LUA_STATIC)
add_executable(lua_compiler ${LUA_SOURCE_FOLDER}/luac.c)
target_link_libraries(lua_compiler lualib)
else()
add_executable(lua_compiler ${LUA_SOURCE_FOLDER}/luac.c ${LOCAL_SOURCES_C})
target_include_directories(lua_compiler PRIVATE "${LUA_SOURCE_FOLDER}")
if(APPLE)
target_link_libraries(lua_compiler readline)
else()
target_link_libraries(lua_compiler m ${CMAKE_DL_LIBS})
endif()
endif()
target_compile_definitions(lua_compiler PRIVATE _CRT_SECURE_NO_WARNINGS)
if (NOT WIN32)
target_compile_options(lua_compiler PRIVATE -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-sign-compare -Wno-string-plus-int)
Expand Down
6 changes: 2 additions & 4 deletions src/lualib/luajit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (WIN32)
set_target_properties(lualib
PROPERTIES
IMPORTED_LOCATION ${LUA_BIN_FOLDER}/src/lua51.lib
INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src"
INTERFACE_INCLUDE_DIRECTORIES "${LUA_BIN_FOLDER}/src"
INTERFACE_COMPILE_DEFINITIONS "LUAJIT_VERSION=1"
)

Expand Down Expand Up @@ -155,13 +155,11 @@ if (UNIX OR APPLE)
set_target_properties(lualib
PROPERTIES
# IMPORTED_LOCATION ${LUAJIT_LIB_PATH} # cmake bullshit. spent days figuring this and turns out set_target_properties does squat shit while set_property works fine.
INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src"
INTERFACE_INCLUDE_DIRECTORIES "${LUA_BIN_FOLDER}/src"
INTERFACE_COMPILE_DEFINITIONS "LUAJIT_VERSION=1"
)
set_property(TARGET lualib PROPERTY IMPORTED_LOCATION ${LUAJIT_LIB_PATH})

# install generated files
install(DIRECTORY ${LUA_INSTALL_PATH}/ DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()


Loading