Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ba250f7
feat(sol): Add sol releases files
iThorgrim Jul 6, 2026
88c5b95
feat(LuaEngine/ALEHandles): Add safe references for game objects
iThorgrim Jul 6, 2026
24e54d3
fix(CMake/LuaJIT): Correct include directories for LuaJIT
iThorgrim Jul 6, 2026
2d4093d
feat(LuaEngine/ALEHandles): Add Transport header for object handling
iThorgrim Jul 6, 2026
bdb25a3
refactor(LuaEngine): Update LuaEngine to use sol2 for Lua bindings
iThorgrim Jul 6, 2026
faa186f
feat(LuaEngine/ALEBind): Implement dynamic Lua object conversion
iThorgrim Jul 6, 2026
63f8f1c
feat(LuaEngine): Add CallAllFold and FoldCallbacks for event handling
iThorgrim Jul 6, 2026
687b675
refactor(LuaEngine/ALEEventMgr): Update LuaEvent structure and types
iThorgrim Jul 6, 2026
6309dc9
refactor(LuaEngine/ALEEventMgr): Simplify event handling logic
iThorgrim Jul 6, 2026
37dd543
feat(LuaEngine): Add CallFunction for Lua callback execution
iThorgrim Jul 6, 2026
0652f27
refactor(LuaEngine/HttpManager): Update HttpWorkItem and HttpResponse…
iThorgrim Jul 6, 2026
b2e3945
feat(LuaEngine): Add NewHandleType for Lua usertype creation
iThorgrim Jul 6, 2026
be9e279
feat(LuaEngine/Methods): Add registration functions for Lua types
iThorgrim Jul 6, 2026
93424b6
refactor(LuaEngine/Methods): Update comments for clarity
iThorgrim Jul 6, 2026
e662f07
feat(LuaEngine/Methods): Add new method bindings for Lua types
iThorgrim Jul 6, 2026
d440db3
refactor(LuaEngine/hooks): Simplify function calls and improve readab…
iThorgrim Jul 6, 2026
98379cf
feat(LuaEngine/ALEBind): Add overloads for ToLuaDynamic function
iThorgrim Jul 6, 2026
bf728a3
feat(LuaEngine/Handles): Add TransportRef class and methods
iThorgrim Jul 6, 2026
df417f6
refactor(LuaEngine/ALECompat): Remove obsolete compatibility files
iThorgrim Jul 7, 2026
b7b2bde
refactor(LuaEngine/lmarshal): Remove unused lmarshal files
iThorgrim Jul 7, 2026
b468b92
refactor(LuaEngine/ALEIncludes): Remove unused ALEIncludes header file
iThorgrim Jul 7, 2026
48ba05e
fix(DB/NPC): Correct NPC spawn locations in starting zones
iThorgrim Jul 7, 2026
2d35fde
refactor(Core): Simplify lua path variable initialization
iThorgrim Jul 7, 2026
109835a
refactor(LuaEngine): Remove unused ALETemplate and HookHelpers headers
iThorgrim Jul 7, 2026
cb4516e
feat(LuaEngine): Add PetRef class for handling Pet references
iThorgrim Jul 7, 2026
b6afb2a
refactor(LuaEngine): Replace GET_GUID() with GetGUID() calls
iThorgrim Jul 7, 2026
f01c61b
refactor(LuaEngine): Use emplace for inserting keys in keysById
iThorgrim Jul 7, 2026
00dfe86
feat(LuaEngine): Add HandleFor specialization for Pet type
iThorgrim Jul 7, 2026
82fb40a
refactor(LuaEngine): Simplify DBCDefinition and REGISTER_DBC macro
iThorgrim Jul 7, 2026
fce3e96
refactor(LuaEngine): Move ScriptedAI include to correct location
iThorgrim Jul 7, 2026
7d86be0
feat(LuaEngine/Serialization): Implement binary serialization for ins…
iThorgrim Jul 7, 2026
e5c4e52
fix(LuaEngine/hooks): Include missing Spell.h header
iThorgrim Jul 7, 2026
44554a0
refactor(LuaEngine/ALEUtility): Remove unused GUID macros and definit…
iThorgrim Jul 7, 2026
2814fc5
refactor(CMake): Enable exception safety for sol bindings
iThorgrim Jul 7, 2026
d174539
refactor(LuaEngine/ALEBind): Improve ToLua and MakeFunction templates
iThorgrim Jul 7, 2026
fa28bd3
refactor(LuaEngine): Remove unused method includes from LuaFunctions
iThorgrim Jul 7, 2026
84eaf5b
feat(LuaEngine/Methods): Refactor all methods with Sol signature
iThorgrim Jul 7, 2026
952b062
fix: Fix compilation with non Luajit version and static=off
iThorgrim Jul 7, 2026
babdc0f
refactor(LuaEngine): Implement DispatchGuard for nested dispatch levels
iThorgrim Jul 7, 2026
bfb3ebf
refactor(LuaEngine/ALEBind): Correct AuctionHouseObject type name
iThorgrim Jul 7, 2026
c7e45a7
refactor(LuaEngine/ALEBind): Improve object type handling in ToLuaDyn…
iThorgrim Jul 7, 2026
f54c216
refactor(LuaEngine/ALEInstanceAI): Enhance table encoding to prevent …
iThorgrim Jul 7, 2026
d4d2f43
fix(LuaEngine/Methods): Fix some methods
iThorgrim Jul 7, 2026
174429d
refactor(LuaEngine/ALEScriptCache): Improve file timestamp handling
iThorgrim Jul 7, 2026
a9af2f4
refactor(CMake): Update target_include_directories for sol
iThorgrim Jul 7, 2026
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
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,17 @@ if (LUA_VERSION MATCHES "luajit")
else()
add_subdirectory(src/lualib/lua)
endif()

# sol (C++ <-> Lua binding library, header-only) is bundled in src/lualib/sol.
# Attaching it to lualib as INTERFACE propagates <sol/sol.hpp> and its compile
# definitions to every consumer of lualib, whichever Lua backend is selected.
# SYSTEM keeps the vendored header out of our warning surface: sol carries
# GCC-only pragmas that clang would otherwise reject under -Werror.
target_include_directories(lualib SYSTEM INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/src/lualib")

# Keep sol runtime safety checks enabled in every build type: script errors must
# surface as catchable Lua errors, never as undefined behaviour in the server.
# SOL_EXCEPTIONS_SAFE_PROPAGATION=0 makes sol catch C++ exceptions at the
# binding boundary and convert them into regular Lua errors carrying their
# message; without it LuaJIT swallows them into a generic "C++ exception".
target_compile_definitions(lualib INTERFACE SOL_ALL_SAFETIES_ON=1 SOL_EXCEPTIONS_SAFE_PROPAGATION=0)
61 changes: 61 additions & 0 deletions src/LuaEngine/ALEBind.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (C) 2010 - 2025 Eluna Lua Engine <https://elunaluaengine.github.io/>
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/

#include "ALEBind.h"

#include "Corpse.h"
#include "GameObject.h"
#include "Item.h"
#include "Object.h"
#include "Pet.h"
#include "Player.h"
#include "Transport.h"

namespace ALEBind
{
sol::object ToLuaDynamic(sol::state_view lua, Object const* obj)
{
if (!obj)
return sol::make_object(lua, sol::nil);

if (Player const* player = obj->ToPlayer())
return sol::make_object(lua, PlayerRef(player));

if (Creature* creature = const_cast<Object*>(obj)->ToCreature())
{
if (Pet const* pet = creature->ToPet())
return sol::make_object(lua, PetRef(pet));

return sol::make_object(lua, CreatureRef(creature));
}

if (GameObject* go = const_cast<Object*>(obj)->ToGameObject())
{
if (Transport const* transport = go->ToTransport())
return sol::make_object(lua, TransportRef(transport));

return sol::make_object(lua, GameObjectRef(go));
}

if (Corpse const* corpse = obj->ToCorpse())
return sol::make_object(lua, CorpseRef(corpse));

if (obj->IsItem())
return sol::make_object(lua, ItemRef(static_cast<Item const*>(obj)));

return sol::make_object(lua, sol::nil);
}

sol::object ToLuaDynamic(sol::state_view lua, WorldObject const* obj)
{
return ToLuaDynamic(lua, static_cast<Object const*>(obj));
}

sol::object ToLuaDynamic(sol::state_view lua, Unit const* unit)
{
return ToLuaDynamic(lua, static_cast<Object const*>(unit));
}
}
Loading
Loading