Initial work on LUA scripting.

This LUA scripting implementation uses the sol header only C++ wrapper for the native LUA libraries.

The API does not follow the original LU scripting. Each instance of a script is in its own LUA-State, and has 'self' as a global. There are hooks to all the implemented CppScript methods, as well as a subset of the entity functionallity. Has to be expanded upon.

This is local work which has been sitting for awhile; thought someone might like to take a look at it.
This commit is contained in:
wincent
2022-04-13 19:51:14 +02:00
parent a0a9936e47
commit 5f689104af
18 changed files with 31747 additions and 1 deletions

View File

@@ -209,6 +209,14 @@ include_directories(${PROJECT_SOURCE_DIR}/thirdparty/cpplinq/)
include_directories(${PROJECT_SOURCE_DIR}/dNet/)
include_directories(${PROJECT_SOURCE_DIR}/dScripts/)
# Link dGame to LUA
if(__include_lua__)
find_package(Lua REQUIRED)
include_directories(/usr/include ${LUA_INCLUDE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/dLua/)
endif(UNIX)
# Default to linking to libmysql
set(MYSQL_LIB mysql)
if(WIN32)
@@ -355,6 +363,19 @@ ${PROJECT_SOURCE_DIR}/dGame/dUtilities/*.cpp
${PROJECT_SOURCE_DIR}/dScripts/*.cpp
)
# If we are including LUA, include the dLua files in dGame
if(__include_lua__)
file(
GLOB SOURCES_DLUA
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dLua/*.cpp
)
# Append the dLua files to the dGame files
set(SOURCES_DGAME ${SOURCES_DGAME} ${SOURCES_DLUA})
endif(__include_lua__)
# Source Code for dZoneManager
file(
GLOB SOURCES_DZM
@@ -466,6 +487,15 @@ target_link_libraries(ChatServer pthread)
target_link_libraries(ChatServer dl)
endif(UNIX)
# Link dGame to LUA
if(__include_lua__)
find_package(Lua REQUIRED)
target_link_libraries(dGame ${LUA_LIBRARIES})
message(STATUS "Linking dGame to LUA " ${LUA_LIBRARIES})
endif(UNIX)
# Compiler flags:
# Disabled deprecated warnings as the MySQL includes have deprecated code in them.
# Disabled misleading indentation as DL_LinkedList from RakNet has a weird indent.