HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Function Interface & PJASS 1.0h

09-26-2007, 09:26 PM#1
MaD[Lion]
ok my system was working fine but the new PJASS fucked it up...

When i compile a function interface tat returns nothing it says that a condition something function must return boolean...
And funtion interface documentation should say something about this.

Also when i change it to return boolean, i cant get the array index for my function interface anymore, not even with typecasting

integer(Behaviour.Something)
09-26-2007, 09:32 PM#2
botanic
Post the original code please ^.^
09-26-2007, 10:08 PM#3
PitzerMike
Which JASS Helper version are you using?
09-26-2007, 11:06 PM#4
Hitchhiker
i had a similiar problem with pJass 1.0h and jassHelper 0.9.9.2. Sometimes when I used something like
Collapse JASS:
struct A
    method func takes nothing returns nothing
        //code
        if someVar then
            return
        endif
        //other code
    endmethod
endstruct
it wouldnt compile.
I think it has something todo with the way how jassHelper converts methods into "real" jass and functions using "return".
pJass complained about a function "returning nothing instead of boolean". But if I replaced "return" with "return false", it complained about the method "returning boolean instead of nothing".
09-26-2007, 11:12 PM#5
MaD[Lion]
i always use the latest jasshelper. And ok even if the problem is the boolean thingy, then how do i recieve array index for a function interface (vJass related)
09-26-2007, 11:18 PM#6
Vexorian
Quote:
Originally Posted by Hitchhiker
i had a similiar problem with pJass 1.0h and jassHelper 0.9.9.2. Sometimes when I used something like
Collapse JASS:
struct A
    method func takes nothing returns nothing
        //code
        if someVar then
            return
        endif
        //other code
    endmethod
endstruct
it wouldnt compile.
I think it has something todo with the way how jassHelper converts methods into "real" jass and functions using "return".
pJass complained about a function "returning nothing instead of boolean". But if I replaced "return" with "return false", it complained about the method "returning boolean instead of nothing".
It would have been useful if you reported it...

MaD[Lion] It is a jasshelper bug, so help me fix it, post the code that then generates the bugged function...
09-27-2007, 07:24 AM#7
MaD[Lion]
It is just the functions in the macros in my system:
Ok i figured the array index thingy might be my fault, i forgot to change the return type of the function interface declaration to boolean too. But when i have done that.... something more weird happen. This function:

Collapse JASS:
    function Bnc_BUG takes nothing returns boolean
        local Motion M = MaDOS_CurrentMotion
        local unit P = M.P.Unit
        local Object O = M.O
        local boolean Bnc = true

        if (Bnc==false) then
            return false
        endif
        //Cleanup
        set P = null
        return true
    endfunction

Returns nothing after vJass compilation instead of boolean
something like this:

Collapse JASS:
function sa___prototype4_Bnc_BUG takes nothing returns nothing
...
endfunction

This made PJASS report error that this function which is used in Boolexpr does not return a boolean.

And my interface is like this:

Collapse JASS:
    function interface Behaviour takes nothing returns boolean

Everything has worked before, until the boolean return for boolexpr came and it messed up after i changed them into returning boolean.
09-27-2007, 01:50 PM#8
Vexorian
the thing is that latest jasshelper should have fixed that, gonna check it out.
09-27-2007, 02:57 PM#9
MaD[Lion]
tell me when u figure it out... cus i kinda want my system to work with latest compilers
09-27-2007, 03:43 PM#10
Vexorian
test this for a while . http://www.wc3campaigns.net/pastebin...426691103fc7bf
09-27-2007, 04:16 PM#11
MaD[Lion]
no more report... but the system doesnt work ingame.

When the function interfaces returns boolean as i posted above, its something wrong tat make it refuse to run the codes below where i did function.evaluate()

And so i tried set the function interfaces to take nothing and return nothing, well no report here either, and all codes below the eval runs. Just the the function interface doesnt run... The function interface array index was possible to get, but somehow it doesnt run the function... So im stuck again waiting for explaination/documentation of how it work, or how to fix
09-27-2007, 05:56 PM#12
Vexorian
Well, replace the test version with the older one.

The problem was caused by using "return" statements on functions that return nothing AND are used in function pointers.

You can refactor those functions with some if then elses.

If not wait for tonight in which I'll really fix the problem AND the new bug in the test version.