• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Convert integer to code

Status
Not open for further replies.
Level 24
Joined
Aug 1, 2013
Messages
4,658
Hi all.

Why can't I do this?
JASS:
function try takes nothing returns nothing
    local integer i = try    
    
    call TriggerAddAction(gg_trg_Test_Settings, function i)
endfunction

When I do call TriggerAddAction(gg_trg_Test_Settings, try)
I see that "try" is an integer and so I have to put the keyword "function" before it.
But why doesn't it work with real integers?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Well... Blizzard doesn't allow us to do code array
But when I forget to put "function" in TriggerAddAction(), TriggerAddCondition() functions, JASSHelper tells me that that function is actually an integer.

So I thought, maybe I can simulate code array with integer array.

I want that because I am making an event system this week.
I can indeed just run triggers on the events but it would be nice if I could run functions directly.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Well... Blizzard doesn't allow us to do code array
But when I forget to put "function" in TriggerAddAction(), TriggerAddCondition() functions, JASSHelper tells me that that function is actually an integer.

So I thought, maybe I can simulate code array with integer array.

I want that because I am making an event system this week.
I can indeed just run triggers on the events but it would be nice if I could run functions directly.

The function is not an integer, its just that JassHelper replaces function names with integers so that you can asign them to an integer variable.

But thats a compile-time conversion. What you would need is a run-time conversion.

However, there is not even a compile-time conversion back from integer to code, so that can't work.
 
Status
Not open for further replies.
Top