• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

A Lua Engine for Warcraft 3

Status
Not open for further replies.
Level 6
Joined
May 1, 2012
Messages
95
The following software is an extension for Warcraft 3 which can let it execute lua script. You can just click 'launchwar3.bat' to lauch Warcraft 3 with this extension.

Call the following function in jass2 script
JASS:
call Cheat("exec-lua: hello.lua")
Now the imported 'hello.lua' is lauched.This function is the same as (require 'hello.lua') in lua.

Here is a simple example
Code:
-- jass.common is a library, it contains all the function in common.j
local cj = require 'jass.common'

cj.TimerStart(cj.CreateTimer(), 1.00, true,
    function ()
        cj.DisplayTimedTextToPlayer(cj.GetLocalPlayer(), 0, 0, 60., 'hello')
    end
)
For more information please check the attachment 'example.w3x' and Introduction

You can find more lua engine related source code here.GitHub

In addition, you can use jass2lua tool to translate your jass base map to a lua base map.jass2lua
 

Attachments

  • example.w3x
    17.4 KB · Views: 496
  • lua-engine.zip
    1.6 MB · Views: 691
Last edited:
Level 1
Joined
Dec 18, 2011
Messages
1
Hey, I have just tried your extension. Awesome idea isnt it? Glad to see this kind of lua software is in developing!
 
Level 6
Joined
May 1, 2012
Messages
95
Nestharus said:
Your tool is useful, but you need to consider these things

1. why should your tool be used over SharpCraft?

2. why would a player specially download your tool?

Now, you can overtake SharpCraft if you address point #2. How do you address this?

If a map does not currently support Lua, then create a bat file for the user and just have the user run that. The bat file would download your thing and set an *exe* or a jar that then calls wc3 through your thing. This would enable people to play maps using your tool rather easily. Now, MindWorX is against this idea, which is why SharpCraft has yet to be adopted. It likely never will be adopted. If a developer decides to use SharpCraft or your tool, their target audience will be very small. They'd be committing their map to suicide.


So keep that in mind =)


Otherwise, good job.

I think the best way is collaboration with the Warcraft3 platform.The tool has been supported by 11game.This is the most popular platform in China.
 

MindWorX

Tool Moderator
Level 20
Joined
Aug 3, 2004
Messages
709

That will collide with SharpCraft behavior. SharpCraft allows people to get a callback from the Cheat native, and with such a generic command like "run" it's bound to cause issues. Perhaps a more specific command would be in order?
JASS:
    call Cheat("eval-lua: command")
    call Cheat("exec-lua: file")
    call Cheat("eval-cs: command")
    call Cheat("exec-cs: file")
This makes it a more standardized way of using both systems, and has a much smaller chance of colliding with the mappers own commands.
 
Level 6
Joined
May 1, 2012
Messages
95
That will collide with SharpCraft behavior. SharpCraft allows people to get a callback from the Cheat native, and with such a generic command like "run" it's bound to cause issues. Perhaps a more specific command would be in order?
JASS:
    call Cheat("eval-lua: command")
    call Cheat("exec-lua: file")
    call Cheat("eval-cs: command")
    call Cheat("exec-cs: file")
This makes it a more standardized way of using both systems, and has a much smaller chance of colliding with the mappers own commands.

ok, this is good
 
Status
Not open for further replies.
Top