Skip to content

Repository files navigation

War3 Lua - 1.3.8 (Blight)

luawarcraftlicenseforks

War3 Lua - modification that allows you to run lua scripts at the JASS level. Lua does not replace the original scripting system in the game, but only expands its capabilities.

Some natives doesn't work (thx jass for beautiful VM).

Pictures

Usage

Just create war3map.lua and move into your map. You can use fast code testing by including external script. Don't forget to use developer mode to unlock some features.

war3map.lua

require"script"

script.lua

localunit=CreateUnit(Player(0), FourCC("Hpal"), 0, 0, 0) --> Creating unitSetUnitColor(unit, ConvertPlayerColor(1)) --> Changing color

If you wanna display some text, use "print" to type it in the chat, and "printc" to display text in console. Don't forget to use console mode.

Example

There's a little code to showing jass leaks and memory that's being used by the lua machine.

localITERATION_COUNT=100;
TimerStart(CreateTimer(), 0, false, function()
statisticLeaderboard=CreateLeaderboard();
LeaderboardSetLabel(statisticLeaderboard, "Debug stats");
PlayerSetLeaderboard(GetLocalPlayer(), statisticLeaderboard);
LeaderboardDisplay(statisticLeaderboard, true);
LeaderboardAddItem(statisticLeaderboard,"Handles", 0, Player(0))
LeaderboardAddItem(statisticLeaderboard,"Used memory", 0, Player(1))
LeaderboardSetSizeByItemCount(statisticLeaderboard, 2);
TimerStart(GetExpiredTimer(), 0.1, true, function()
localresult=0localmin=-1locallocs= {}
fori=1, ITERATION_COUNTdolocalloc=Location(0, 0)
locs[i] =loclocalid=GetHandleId(loc)
id=id-0x100000ifmin==-1thenmin=idendifid>resultthenresult=idelseifid<minthenmin=idendendifresult-min>ITERATION_COUNTthenresult=minelseresult=result-ITERATION_COUNTendfori=1, #locsdoRemoveLocation(locs[i])
endLeaderboardSetItemValue(statisticLeaderboard, 0, R2I(result));
LeaderboardSetItemValue(statisticLeaderboard, 1, R2I(collectgarbage("count")));
end)
end)

Installation

  • Move the folder Scripts, Maps and war3_lua.mix to the game folder
  • Run the game (type "-dev" to activate developer mode and "-console" to use console)
  • Open the map with war3map.lua file inside

License

This modification is available as open source under the terms of the MIT License.

About

War3 Lua is a modification that allows you to run lua scripts at the JASS level.

Topics

Resources

Stars

48 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages