Easier Return Bug

Reaction score
341
It requires no preloading and can be parsed directly inside the editor. I've made a litte framework for anyone who wants to use this;

Set NOT_HANDLE to true if the return value is not a hande (integer may be the only thing that would require you to set it to true).

JASS:
library Typecast

    globals
        private hashtable HASH = InitHashtable()
    endglobals
    
    //! textmacro TYPECAST_MACRO takes NAME, HANDLE, RETURN, HASHFUNC, NOT_HANDLE
    function $NAME$ takes $HANDLE$ var returns $RETURN$
        static if ($NOT_HANDLE$) then
            call SaveFogStateHandle(HASH, 0,0, ConvertFogState(var))
            return $HASHFUNC$(HASH, 0, 0)
        else
            call SaveFogStateHandle(HASH, 0, 0, ConvertFogState(GetHandleId(var)))
            return $HASHFUNC$(HASH, 0, 0)
        endif
    endfunction
    //! endtextmacro
    
    //! runtextmacro TYPECAST_MACRO("I2U", "integer", "unit", "LoadUnitHandle", "true")
    
endlibrary
 

Azlier

Old World Ghost
Reaction score
461
Naw. We still can't run viruses or anything.

This isn't even return bug, technically. It can't even do code, if I'm reading this correctly.
 
Reaction score
341
Naw. We still can't run viruses or anything.

This isn't even return bug, technically. It can't even do code, if I'm reading this correctly.

You're right it can't do code. But it is still a typecasting bug. It can convert anything that is a handle.

The above converts an integer into a unit. Read the link I posted to see more of how it works rather than me explaining it all over again.
 

Azlier

Old World Ghost
Reaction score
461
I know how it works. Native I2H using Convertblahblah, been done before. Just not used to typecast. Not that it's useful with Return Nothing, which is more flexible and should be faster. :p
 
Reaction score
341
I know how it works. Native I2H using Convertblahblah, been done before. Just not used to typecast. Not that it's useful with Return Nothing, which is more flexible and should be faster. :p

The point is it compiles in the editor without having to do preloading.

Not sure of any logical typecasts except for C2I/H2I.
 

Azlier

Old World Ghost
Reaction score
461
And Return Nothing can be haxed to do that, too. I forget the exact layout.

EDIT: Here it is. Thanks, Deaoaoed.
JASS:
function N2H takes nothing returns handle
    if false then 
         return null 
    elseif true then 
    else 
         return null 
    endif
endfunction
 

Azlier

Old World Ghost
Reaction score
461
Yes.

JASS:
function Integer takes integer i returns integer
    return i
endfunction

function I2H takes integer i returns handle
    call Integer(i)
    if false then 
         return null 
    elseif true then 
    else 
         return null 
    endif
endfunction


>Blizzard protected the code variables. ><

C2I/I2C have been successful. Don't lie to yourself.
 

Azlier

Old World Ghost
Reaction score
461
Well, what do you want to typecast? Anything works.

What's really cool is using it to transfer a hashtable to a preloader script. Jesus4Lyf figgered dat one out.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
C2I/I2C have been successful. Don't lie to yourself.
xD. but pjass does not like this :
JASS:
function Integer takes integer i returns integer
    return i
endfunction

function I2H takes integer i returns handle
    call Integer(i)
    if false then 
         return null 
    elseif true then 
    else 
         return null 
    endif
endfunction

zz
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Yeah, I need PJASS to like my code...
Is there a method that PJASS likes?
 

weaaddar

New Member
Reaction score
6
Just curious what is the use of I2C/C2I, as the founder of this "bug", I can't actually think of why you'd need anything more.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top