W3LuaEnv is a free tool for Warcraft III modders who want to program their maps using Lua.
It helps you keep a modular codebase and seamlessly integrates with the World Editor workflow.
No need to close the World Editor or go through tedious intermediate steps to inject code. Just edit your scripts with your preferred editor and press F9 in the Trigger Editor to apply changes instantly.
W3LuaEnv generates an output script from your modular project and injects it before running the map—simple and efficient.
Tutorial
Open the World Editor and create a new map named, for example, mymod.w3m.
Go to Scenario → Map Description...
Change the Name of the map. This prevents a message box from appearing when pressing F9, allowing the map to load automatically. For example, set the name to mymod:
Go to Scenario → Map Options...
Select Lua as the Script Language.
In the directory where your map is saved (mymod.w3m), create a folder named src:
Inside src, create two script files: main.lua and module.lua
main.lua code:
--main.lua
local mod = require('module')
local timer = CreateTimer()
TimerStart(timer, 0, false, function()
mod.say_hello()
end)
module.lua code:
--module.lua
M = {}
function M.say_hello()
print('Hello!')
end
return M
Download W3LuaEnv:
Extract the files and open W3LuaEnv.exe:
Click the [Select main script] button and choose main.lua:
You should see this screen:
Now you can minimize W3LuaEnv and continue working on your map while editing your modular codebase. W3LuaEnv monitors changes to your scripts and waits for you to press F9 in the Trigger Editor.
Open the Trigger Editor and select mymod.w3m in the left panel:
On the right, under "Custom Script Code", click the text box to focus it, then press [F9].
Your code will be loaded automatically, and the map will run in Warcraft III. You should see "Hello!" printed when the game starts.
When you press F9, W3LuaEnv detects that you're in the Trigger Editor and triggers automated actions. You can check the app log for details:
Whenever you modify your code and want to test it, simply return to the Trigger Editor, click the text box, and press F9. You don't need to clear the previous code—W3LuaEnv handles everything for you.
In summary, W3LuaEnv enables modular Lua programming while keeping your World Editor workflow smooth and uninterrupted.
Hope you find it useful. glhf!
If you want, you can download and try the following example map, built with several Lua modules: