[JASS] Module, use Globals?

Status
Not open for further replies.
Level 11
Joined
Apr 6, 2008
Messages
760
can a Module use Globals when implement in an other struct from the structs scope?

JASS:
module Test

real a
real b
real c

      method Math takes nothing returns returns real
          set .a = A
          set .b = B
          set .c = .a * .b
     endmethod

endmodule

JASS:
scope A

globals
    private constant real A = 2
    private constant real B = 3
endglobals

private struct Data

static method ASD takes nothing returns nothing
    local thistype D = thistype.allocate()

    call thistype.Math()
endmethod

implement Test

endstruct

I wanna use this way to create casting bar for some spells, so with globals i can get the casting time and other stuff (customizeable for each spell we can say)

EDIT:

on other thoughts i could use a textmacro, but still is it possible?
 
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
AFAIK the code inside module is just copy/pasted into the struct pretty much like how textmacro's work, so the actual code is only evaluated when the struct is compiled. So technically, you can write utter gibberish inside modules, and it'll compile as long as you never implement it in a struct.
 
Status
Not open for further replies.
Top