|
|
#2101 | |
|
User
Join Date: Nov 2007
Posts: 129
![]()
|
guess I found a bug (or misunderstood something).
__________________code: JASS:library libbug private function init takes nothing returns nothing call init1.execute() endfunction private function init1 takes nothing returns nothing endfunction endlibrary "init1 is not a type that allows . syntax" any ideas? Quote:
Last edited by gekko : 07-14-2009 at 01:16 PM. |
|
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#2102 | |
|
User
Join Date: Oct 2006
Posts: 1,490
|
Quote:
you have to use a private keyword like that : JASS:library libbug private keyword init1 private function init takes nothing returns nothing call init1.execute() endfunction private function init1 takes nothing returns nothing endfunction endlibrary Or change the position of the functions like that : JASS:library libbug private function init1 takes nothing returns nothing endfunction private function init takes nothing returns nothing call init1.execute() endfunction endlibrary Last edited by Troll-Brain : 07-14-2009 at 01:28 PM. |
|
|
|
|
|
|
#2103 | |
|
User
Join Date: Jan 2009
Posts: 28
|
Quote:
I'll give it a whirl and see how it works with updating the AI imports. Thanks! |
|
|
|
|
|
|
#2104 |
|
User
Join Date: Apr 2008
Posts: 189
|
vex since you where asked to do linebreaks with semicolons why dont you insted do this?
__________________ JASS:set i = 0 loopuntil (i >= 5) call BJDebugMsg(I2S(i)) set i = i + 1 endloop its compiled to: JASS:set i = 0 loop exitwhen (i >= 5) call BJDebugMsg(I2S(i)) set i = i + 1 endloop that would be awesome and btw why not add this (i know that you dont like c that much but it would be cool) JASS:for (integer i = 0, i < 5, i+1) call IMsg(i) endfor //compiled to local integer i // for detected (integer i not jet loaded so load it now) set i = 0 loop exitwhen not (i < 5) call IMsg(i) set i = i + 1 endloop each time i load a for and ask for integer you must check is it already declared. JASS:local integer i for (i = 0, i < 5, i+1) call IMsg(i) endfor this would as well be acceptable. i think that for loop is really missing the jass, so its a suggestion to add it! it would be good if you add at leat one of them loopuntil or for... if you add both it would be even better... Greets! ~Dark Dragon |
|
|
|
|
|
#2105 |
|
oO
Join Date: Jul 2008
Posts: 577
![]() ![]() ![]()
|
Thats not a struct Litany, >.>
|
|
|
|
|
|
#2106 | |
|
User
Join Date: Jan 2009
Posts: 28
|
Quote:
|
|
|
|
|
|
|
#2107 | |
|
User
Join Date: May 2008
Posts: 80
|
Quote:
That is really ugly in jass syntax! I would prefer a pascal like syntax. JASS:local integer i for i = 1 to 1 call BJDebugMsg(I2S(i)) endfor |
|
|
|
|
|
|
#2108 | |
|
User
Join Date: Apr 2008
Posts: 189
|
Quote:
its not like yours is bad i can live with it as well but where is increment? EDIT: hmm as i remember syntax would be: JASS:local integer i for i = 1 to 10 step 1 endfor //or for i = 10 to 0 step -2 endfor questions for vex! 1) do you like "for loop"? like you said you dont like i++ stuff 2) is any of this syntaxes good enough? 3) do you think you will ever implement any syntax for "for loop"? its importand to know the answers coz i dont want to keep suggesting it if it bothers u! Last edited by Dark_Dragon : 07-15-2009 at 11:20 AM. |
|
|
|
|
|
|
#2109 |
|
extends net.wc3c.Jasser
|
It would be great if default values on interface methods work with null structs... Currently using them with invalid instances likely to return unexpected values or get the thread killed silently
Also, what about making "local" keyword optional? I'd also like to see something like "static auto/local variables" in C... Last edited by ToukoAozaki : 07-15-2009 at 04:16 PM. |
|
|
|
|
|
#2110 | |
|
In Flames
Join Date: Jan 2006
Posts: 1,153
|
Quote:
have you tried: defaults 0 ? If this doesnt work aswell, this should really get fixed.. Last edited by akolyt0r : 07-15-2009 at 04:54 PM. |
|
|
|
|
|
|
#2111 | |
|
extends net.wc3c.Jasser
|
Quote:
JASS:library A initializer Init interface B method operator intValue takes nothing returns integer defaults 0 method operator boolValue takes nothing returns boolean defaults false endinterface private function OnStart takes nothing returns nothing local B b = B(0) call BJDebugMsg("OnStart") call BJDebugMsg(I2S(b.intValue)) if b.boolValue then call BJDebugMsg("true") else call BJDebugMsg("false") endif endfunction private function Init takes nothing returns nothing call TimerStart(CreateTimer(), 0.0, false, function OnStart) endfunction endlibrary This yields: JASS://Generated method caller for B._get_intValue function sc__B__get_intValue takes integer this returns integer set f__arg_this=this //no struct used this interface. We should probably avoid adding it... return f__result_integer endfunction //Generated method executor for B._get_intValue function sx__B__get_intValue takes integer this returns nothing set f__arg_this=this endfunction //Generated method caller for B._get_boolValue function sc__B__get_boolValue takes integer this returns boolean set f__arg_this=this //no struct used this interface. We should probably avoid adding it... return f__result_boolean endfunction //Generated method executor for B._get_boolValue function sx__B__get_boolValue takes integer this returns nothing set f__arg_this=this endfunction //Generated destructor of B function sc__B_destroy takes integer this returns nothing if this==null then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Attempt to destroy a null struct of type: B") return elseif (si__B_V[this]!=-1) then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Double free of type: B") return endif //no struct used this interface. We should probably avoid adding it... set si__B_V[this]=si__B_F set si__B_F=this endfunction //library A: function A___OnStart takes nothing returns nothing local integer b= (0) call BJDebugMsg("OnStart") call BJDebugMsg(I2S(sc__B__get_intValue(b))) if sc__B__get_boolValue(b) then call BJDebugMsg("true") else call BJDebugMsg("false") endif endfunction function A___Init takes nothing returns nothing call TimerStart(CreateTimer() , 0.0 , false , function A___OnStart) endfunction //library A ends |
|
|
|
|
|
|
#2112 |
|
In Flames
Join Date: Jan 2006
Posts: 1,153
|
ah i missunderstood you, i thought that method interfaces which returned structs didnt work somehow .. NVM
__________________ |
|
|
|
|
|
#2113 | |
|
User
Join Date: Nov 2007
Posts: 129
![]()
|
Quote:
I also beg for function static variables! How often do I need one or more globals for just one function (to increase performance over local variables, because these are not needed in every branch of the function and it would be insuficient to alloc memory for them each time the function is called, even if they are only used in one of 100 cases when the function is called). It is so damn ugly to make a globals block above that function and specify all values there. Instead a line inside the function with something like: "local static integer i" would be superb, would make the code look much straighter and really emphasize that this global is only for this function/method. The compiler just had to remove this line from the function and just make a global declaration out of it. (Of course, most function calls would be impossible in static init since its a global declaration) |
|
|
|
|
|
|
#2114 | |
|
User
Join Date: Apr 2008
Posts: 189
|
Quote:
JASS:local static integer i //? that makes no sense static integer i // thats fine second thing if this is not a bug then omg! JASS:struct xxx method onDestroy takes nothing returns nothing endmethod endstruct local xxx x = xxx.create() call x.onDestroy() one guy who i was teaching vjass wrote that and thats how i found about this bug... |
|
|
|
|
|
|
#2115 | |
|
User
Join Date: Nov 2007
Posts: 129
![]()
|
Quote:
I rather ment this: JASS:method bla takes nothing returns nothing local static integer i //or maybe just static integer i endmethod Last edited by gekko : 07-16-2009 at 03:16 PM. |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |