- Joined
- Jun 23, 2007
- Messages
- 4,066
JNGP Lua Edition
Archive Password: "thw" (without quotes)
Google thinks JNGP is malware so it has to be password protected. You can read more about it on the official JNGP page.
As it currently stands in the latest World Editor, you cannot mix scripting languages. You must pick either JASS or Lua. You also cannot require scripts in WC3's Lua so we are essentially forced to type all of our code in an external editor and paste it back into the trigger editor. Because of these limitations I decided I wanted to try and integrate Lua into the editor while also allowing you to code in JASS or vJass.
How to Setup
Using Lua
In order to use Lua you must wrap your code in
Now, if you want call a Lua function from within JASS you must use the
The same rules apply when you are using vJass.
External Lua Files
Because JassHelper's import directive wasn't working properly I made a quick one specifically for Lua files.
You can use relative or absolute paths. This should allow you to easily code in a 3rd party code editor if that's what you want.
Lua VSCode Integration
Archive Password: "thw" (without quotes)
Google thinks JNGP is malware so it has to be password protected. You can read more about it on the official JNGP page.
As it currently stands in the latest World Editor, you cannot mix scripting languages. You must pick either JASS or Lua. You also cannot require scripts in WC3's Lua so we are essentially forced to type all of our code in an external editor and paste it back into the trigger editor. Because of these limitations I decided I wanted to try and integrate Lua into the editor while also allowing you to code in JASS or vJass.
How to Setup
- Make sure you have a copy of an older version of WC3. You can download the 1.26 game files here. It should work with any patch that contains the MPQs.
- Download extract jassnewgenpack-lua-1.1.0.zip.
- Edit "findpath.lua" (in the jngp folder) to point to your WC3 directory and 1.31 executable. There are comments in the file which explain further.
- Run "NewGen WE.exe".
Using Lua
In order to use Lua you must wrap your code in
//! lua
and //! endlua
tags. For example:
Lua:
//! lua
function Trig_Basic_Example_Actions()
TimerStart(CreateTimer(), 1.00, true, function()
print("Lua!")
end)
end
//! endlua
//# +nosemanticerror
tag to prevent PJASS from throwing errors. For example:
JASS:
//! lua
function Trig_Basic_Example_Actions()
TimerStart(CreateTimer(), 1.00, true, function()
print("Lua!")
end)
end
//! endlua
//# +nosemanticerror
function InitTrig_Basic_Example takes nothing returns nothing
set gg_trg_Basic_Example = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Basic_Example, 0.00 )
call TriggerAddAction( gg_trg_Basic_Example, function Trig_Basic_Example_Actions )
endfunction
External Lua Files
Because JassHelper's import directive wasn't working properly I made a quick one specifically for Lua files.
JASS:
//! luaimport "luascripts\test.lua"
Lua VSCode Integration
Attachments
Last edited: