Method Signatures From Blizzard's .j Files as Lua

This bundle is marked as pending. It has not been reviewed by a staff member yet.
  • Like
Reactions: the.Axolotl
I recently decided to switch to an actual editor for my code, instead of just using Xed on individual text files. The Editor I chose was VSCodium. There are a number of advantages here, but there's a slight problem.
Consider the following:
JASS:
//===========================================================================
function CountUnitsInGroup takes group g returns integer
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    set bj_groupCountUnits = 0
    call ForGroup(g, function CountUnitsInGroupEnum)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(g)
    endif
    return bj_groupCountUnits
endfunction
That is a snippit from blizzard.j downloaded here.
Now, it is simply valid to, in Lua, call
JASS:
myVar = CountUnitsInGroup(myGroup)
and it will just work in-game.

However, the signature of
JASS:
function CountUnitsInGroup takes group g returns integer
Is not considered valid by the Lua language server.

So, I vibe-coded a script to re-write all JASS functions and natives like
JASS:
native CreateForce              takes nothing returns force
as Lua, and then manually fixed a few things that it was still complaining about, and decided to upload them here.

I also manually added
JASS:
function FourCC(thing) return thing end
because apparently the FourCC() function doesn't exist in the .j files for some reason.

What these files do is when you add them to a Lua project in VSCodium (it probably works in VSCode, too), they make stop erroring on JASS functions, which WC3 recognizes, but the Lua server doesn't.
This is NOT a complete re-writing of all JASS functions in Lua. All if does is make VSCodium's linter recognize them because they're now valid, defined functions.
Also, disclaimer to anyone who wants to use VSCodium, I don't know a good way to export a VSCodium project into the actual Trigger Editor outside of copy-pasta'ing each text file, but having VSCodium's linter has still increased my sanity by like 50% in the first 4 hours of using it.


Plz tell me if there are any problems. Thx.
Contents

Method Signatures From Blizzard's .j Files as Lua (Binary)

Back
Top