This REPENTOGON mod fixes LuaSocket compatibility by replacing the preloaded socket.core module with a version compiled for the correct Lua version.
mod.cpp - The main mod entry point that performs the LuaSocket injection:
- Hooks into REPENTOGON's mod loading system
- Accesses the Lua state during initialization
- Replaces the preloaded
socket.coremodule with the updated version - Uses Lua's
package.preloadtable to override the default socket library
CMakeLists.txt - Build configuration that:
- Compiles LuaSocket 3.1.0 as part of the build process
- Links the LuaSocket library with the mod code
- Ensures compatibility with REPENTOGON's Lua version
- Generates the
zhlLuaSocketFix.dlloutput
- Build Time: CMake compiles LuaSocket 3.1.0 with the correct Lua version compatibility
- Load Time: When REPENTOGON loads the mod,
mod.cppexecutes - Injection: The mod overwrites
package.preload["socket.core"]with the new implementation - Runtime: When Lua code calls
require("socket"), it gets the fixed version
The fix addresses the core issue where REPENTOGON's existing LuaSocket was built for Lua 5.1, causing crashes when require("socket") was called. By injecting a properly compiled version at runtime, the mod ensures LuaSocket functions correctly within REPENTOGON's Lua environment.
To build this mod, you need:
- A local development environment set up for REPENTOGON with a successful build completed
- CMake 3.1.3 or higher
- Visual Studio with C++ support
Follow the REPENTOGON build steps to set up your development environment first.
- Launch CMake GUI
- Set source and build directories:
- "Where is the source code": Navigate to this project's root directory
- "Where to put the binaries": Choose your preferred build directory
- Configure the project:
- Click "Configure" at the bottom of the CMake GUI
- If prompted, select your compiler (must match your Visual Studio version)
- Set platform to "Win32"
- Leave other options as default and click "Finish"
- Set required configuration variables:
REPENTOGON_SRC: Set to the root path of your REPENTOGON directory (required)MOD_NAME: Set to "zhlLuaSocketFix" or your preferred mod nameISAAC_DIRECTORY: (optional) Path to your Isaac installation directory (whereisaac-ng.exeis located). If set, the compiled DLL will be automatically copied there.
- Generate project files:
- Click "Generate" to create the Visual Studio solution file
- Build in Visual Studio:
- Click "Open Project" to launch Visual Studio
- Build the project (Debug or Release configuration)
- Deploy the mod:
- If
ISAAC_DIRECTORYwas set, the DLL is automatically copied to your Isaac folder - Otherwise, manually copy the built DLL from the build directory (Debug or Release folder) to your Isaac installation
- If
After deployment, start The Binding of Isaac with REPENTOGON enabled. In the Debug Console, test the fix with:
lua local s = require("socket"); print(s._VERSION);