-
Notifications
You must be signed in to change notification settings - Fork 810
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
127 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
include(functions/FetchContent_MakeAvailableExcludeFromAll) | ||
|
||
set(SOL2_ENABLE_INSTALL OFF) | ||
|
||
include(FetchContent) | ||
FetchContent_Declare(sol2 | ||
URL https://github.com/ThePhD/sol2/archive/9c882a28fdb6f4ad79a53a4191b43ce48a661175.tar.gz | ||
URL_HASH MD5=2637c3fcdcce3ff34b36437c1d3b99d1 | ||
) | ||
FetchContent_MakeAvailableExcludeFromAll(sol2) | ||
|
||
target_include_directories(sol2 SYSTEM BEFORE INTERFACE ${CMAKE_CURRENT_LIST_DIR}/sol_config) | ||
target_compile_definitions(sol2 INTERFACE -DSOL_NO_EXCEPTIONS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#pragma once | ||
|
||
#define SOL_SAFE_USERTYPE 1 | ||
#define SOL_SAFE_REFERENCES 1 | ||
#define SOL_SAFE_FUNCTION_CALLS 1 | ||
#define SOL_SAFE_FUNCTION 1 | ||
#define SOL_NO_NIL 0 | ||
#define SOL_IN_DEBUG_DETECTED 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
|
||
// sol2 uses std::cout for debug logging by default. | ||
// We want to use SDL logging instead for better compatibility. | ||
|
||
#include <cstddef> | ||
#include <string> | ||
|
||
#include <sol/stack.hpp> | ||
|
||
namespace devilutionx { | ||
void Sol2DebugPrintStack(lua_State *L); | ||
void Sol2DebugPrintSection(const std::string &message, lua_State *L); | ||
} // namespace devilutionx | ||
|
||
namespace sol::detail::debug { | ||
|
||
inline std::string dump_types(lua_State *L) { | ||
std::string visual; | ||
std::size_t size = lua_gettop(L) + 1; | ||
for (std::size_t i = 1; i < size; ++i) { | ||
if (i != 1) { | ||
visual += " | "; | ||
} | ||
visual += type_name(L, stack::get<type>(L, static_cast<int>(i))); | ||
} | ||
return visual; | ||
} | ||
|
||
inline void print_stack(lua_State *L) { ::devilutionx::Sol2DebugPrintStack(L); } | ||
|
||
inline void print_section(const std::string &message, lua_State *L) { | ||
::devilutionx::Sol2DebugPrintSection(message, L); | ||
} | ||
|
||
} // namespace sol::detail::debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <string_view> | ||
|
||
namespace devilution { | ||
|
||
void LuaInitialize(); | ||
void LuaShutdown(); | ||
void LuaEvent(std::string name); | ||
void LuaEvent(std::string_view name); | ||
|
||
} // namespace devilution |