Using "code"

Arkan

Nobody rides for free
Reaction score
92
I wonder if this method is safe? I tested it and it appears to work fine.
The reason I ask is because I have never seen anyone use it.

JASS:
function test1 takes nothing returns nothing
  call BJDebugMsg("test 1")
endfunction

function testn takes nothing returns nothing
  call BJDebugMsg("test n")
endfunction

function blargh takes integer i returns nothing
  local timer t = NewTimer()
  local code func
  
  if i==1 then
    set func = function test1
  elseif i==n then
    set func = function testn
  endif
  
  call TimerStart(t,5,false,func)
endfunction


Do I need to null code?
 

Trollvottel

never aging title
Reaction score
262
i think, that would be safe.

and i dont think that you have to null code because you cant destroy code, its not a handle, just a pointer to a function, so why should you null it?
 

Romek

Super Moderator
Reaction score
963
Nobody uses that because.. Why would you want to use that? :D
It's perfectly fine I think...
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
It works fine.

And no, you don't need to null code. It has the same rules as integers, reals, booleans, strings, and other specific permanent variables.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top