• 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.

[Lua] How to use SelectUnitSingle()

Status
Not open for further replies.
Level 1
Joined
Apr 8, 2022
Messages
1
Short question: the first code snippet (in JASS) works, but the second one (Lua) does not.

JASS:
function selectPriest takes nothing returns nothing
    call SelectUnitSingle( gg_unit_hmpr_0000 )
endfunction

Lua:
function selectPriest()
    SelectUnitSingle( gg_unit_hmpr_0000 )
end

Why?
 
I assume you are testing that in different maps, because Jass and Lua don't work in the same map at the same time.

If so, your mistake probably is that you have used the exact same gg-variable, although the numerical suffix (0000 in your case) is map-dependent.
To be sure about the gg-variable name, select the unit via any GUI- action and see what name you get there.
Setting a unit variable is the easiest way to do that.

It's also worth noting that the gg_unit variables only exist after such a GUI- select, at least in Lua- mode (not sure about Jass).
So make sure you do that in both maps before testing your function. ;)
 
Status
Not open for further replies.
Top