Skip to content

LuaModLoader

A Lua-based mod loader for the 2020 Steam re-release of GTA IV ("Complete Edition", build 1.2.0.59, x86).

Since the classic ASI Loader and ScriptHookIV do not work on this specific version of GTA IV, LuaModLoader offers a modern alternative: it allows you to run scripts and mods directly in Lua without needing to manipulate raw memory or write C++ code.

Architecture and Operation

The project is divided into two main components:

  • binkw32.dll (Proxy Loader): A lightweight proxy loaded automatically by the game (similar to Ultimate ASI Loader). It forwards real Bink calls to the original file (binkw32_orig.dll) and silently loads the real mod DLL in the background.
  • LuaModLoader.dll (Native Payload): The core of the program. It includes a Lua 5.4 interpreter, DirectX hooks for rendering (D3D9), input hooks (DirectInput), and a built-in text editor.

Key Features

  • In-game Code Editor: Press F6 to open the Lua editor (powered by Scintilla) to write, run, or test code live without restarting the game or using an external program.
  • Dual Naming Conventions (SNAKE_CASE & PascalCase): Directly call over 3,100+ native functions using either standard SNAKE_CASE (e.g. SET_CHAR_HEALTH(ped, 200)) or PascalCase (e.g. SetCharHealth(ped, 200) / GetPlayerId()) for seamless compatibility with ScriptHookDotNet scripts.
  • Rendering and Inputs: Draw rectangles/text on the screen over the game, and cleanly intercept keys (is_key_down, set_menu_open) to isolate game inputs when your mod is active.

Mod Example and Compatible Scripts

LuaModLoader makes creating mods very accessible. Here is a simple example of a script using the loader's native API:

-- Lua mod example: Set the player's health and armor
local player_index = GET_PLAYER_ID()
local player_ped = GET_PLAYER_CHAR(player_index)

SET_CHAR_HEALTH(player_ped, 200)
ADD_ARMOUR_TO_CHAR(player_ped, 100)
msgbox("Health and armor updated!")

Here are some compatible scripts and mods:



Installation (Users)

You do not need to compile the project to use it.

[!TIP] An automatic installer will be available soon to make this process even easier! In the meantime, here is the manual method:

  1. Go to the Releases tab and download the latest version (binkw32.dll, LuaModLoader.dll, Scintilla.dll, Lexilla.dll).
  2. Go to the root folder of GTA IV.
  3. Rename the existing binkw32.dll file to binkw32_orig.dll (VERY IMPORTANT, this file manages the game's video and audio).
  4. Copy the 4 downloaded files into this same folder.

To uninstall: delete the 4 copied files and rename binkw32_orig.dll back to binkw32.dll.

Compilation (Developers)

Requirements:

  • Visual Studio 2026 ("Desktop development with C++", x86 toolset)
  • CMake

[!WARNING] Always target Win32/x86 - GTAIV.exe is a 32-bit process. A DLL compiled in x64 will never work with this game.

cmake -S . -B build -G "Visual Studio 18 2026" -A Win32
cmake --build build --config Release

Output generated in the build\out\Release\ folder:

  • LuaModLoader.dll
  • binkw32.dll
  • (Scintilla.dll and Lexilla.dll will be automatically copied there).