HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Any way to nest textmacroes?

03-27-2010, 12:37 PM#1
Magentix
Suppose this: I want a user to be able to create a set of structs with a textmacro. But inside the struct, there's a ton of functions that could use textmacroing as well.

Ergo: Nesting textmacroes would be the obvious solution, too bad it isn't allowed, though...


Example:
Collapse JASS:
//! textmacro StructCreate takes NAME
    struct $NAME$
        integer i
        real r
        string s
        unit u
        // Etc...

        method setinteger takes integer val returns nothing
            set .i = val
        endmethod

        method setreal takes real val returns nothing
            set .r = val
        endmethod

        method setstring takes string val returns nothing
            set .s = val
        endmethod

        method setunit takes unit val returns nothing
            set .u = val
        endmethod

        // Etc...
    endstruct
//! endtextmacro

//! runtextmacro StructCreate("S1")
//! runtextmacro StructCreate("S2")
//! runtextmacro StructCreate("S3")
//! runtextmacro StructCreate("S4")

Would look so much better as:
Collapse JASS:
//! textmacro Methods takes TYPE, VARNAME 
        method set$TYPE$ takes $TYPE$ val returns nothing
            set .$VARNAME$ = val
        endmethod
//! endtextmacro
//! textmacro StructCreate takes NAME
    struct $NAME$
        integer i
        real r
        string s
        unit u
        // Etc...

        //! runtextmacro Methods("integer","i")
        //! runtextmacro Methods("real","ri")
        //! runtextmacro Methods("string","s")
        //! runtextmacro Methods("unit","u")
        // Etc...
    endstruct
//! endtextmacro

//! runtextmacro StructCreate("S1")
//! runtextmacro StructCreate("S2")
//! runtextmacro StructCreate("S3")
//! runtextmacro StructCreate("S4")

Any way to achieve this?
03-27-2010, 01:09 PM#2
Earth-Fury
No.

Ever?
Possibly.

When?
Later.

Allow me to apologize for the curtness of this post, but it's kinda fun to give perfectly accurate answers in single words.
03-27-2010, 01:38 PM#3
Magentix
Sucks, especially when you know that updating the method functionality would require you to update EVERY method until nested textmacroes are allowed