| 12-14-2008, 09:34 AM | #1 |
How does one call a textmacro with a string (with quotation marks) as one of the arguments? I haven't tested compiling this because I don't have access right now, but it seems like this would go all haywire: JASS://! textmacro Something takes NAME, TYPE, DEFAULT function Something$NAME$ takes $TYPE$ Value returns $TYPE$ if Value != $DEFAULT$ then call DoSomethingWith(Value) return Value endif return $DEFAULT$ endfunction //! endtextmacro //! call runtextmacro Something("Integer", "integer", "0") //! call runtextmacro Something("Handle", "handle", "null") //! call runtextmacro Something("String", "string", """") Or can a string be == null? |
| 12-14-2008, 12:02 PM | #2 |
Just escape the " //! runtextmacro Something("String", "string", "\"\"") |
| 12-14-2008, 09:39 PM | #3 |
Wut? |
| 12-14-2008, 11:02 PM | #4 |
For quotes to exist in a string, they need to have the escape character before them: \" == " Its for the same reason why \\ == \ and also why \n works. |
| 12-15-2008, 01:44 AM | #5 |
Yeah its a standard for most programming languages |
| 12-15-2008, 05:09 AM | #6 |
Oh, thanks! |
| 12-15-2008, 07:37 AM | #7 |
JASS://!textmacro Vexorians_Hate takes CODE $CODE$ //!endtextmacro ... //! runtextmacro Vexorians_Hate("function hate takes nothing returns nothing\ncall BJDebugMsg(\"hate this\")\nendfunction") ... call hate() add more textmacro abuse pls vex |
| 12-15-2008, 07:38 AM | #8 |
ummm...? Does this work? |
