library_once

Azlier

Old World Ghost
Reaction score
461
I'm curious about these two keywords: library_once, scope_once. What do they do? What is their use? I couldn't find anything on the subject in the Jasshelper manual. Then again, I have a habit of skipping lines while reading...
 
Reaction score
456
This code compiles perfectly, but after doing that, you're left only with function H2I, because the second library is ignored (because they use library_once) and it's content isn't added.
JASS:
library_once MyLibrary

    function H2I takes handle h returns integer
        return h
        return 0
    endfunction

endlibrary

library_once MyLibrary

    function W2I takes widget w returns integer
        return w
        return 0
    endfunction

endlibrary


Read what JassHelper manual says:
"The library_once keyword works exactly like library but you can declare the same library name twice, it would just ignore the second declaration and avoid to add its contents instead of showing a syntax error, it is useful in combination with textmacros."
 

Azlier

Old World Ghost
Reaction score
461
So it is in the manual! Sadly, I have a perpetual headache these days. And I'm fourteen. I'll bet being an adult is going to be so much fun...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top