- Joined
- Sep 1, 2009
- Messages
- 37
15 year old me used to make simple spells in gui 10 years ago and jass was too daunting to me. With the release of reforged beta and its support of lua it seems like the perfect time to get back in. I have no experience with lua either but I wanna learn it.
Now to the question, Im not sure about how boolexpr is different from boolean? I was trying out this:
It works with GetUnitsInRangeOfLoc() but not with the condition. So while trying to figure out why I tried this:
where print(a,b) prints the address of function b instead of return value true, why is this happening and how do I fix it?
Now to the question, Im not sure about how boolexpr is different from boolean? I was trying out this:
Lua:
function blizzardEffect()
local trigger = CreateTrigger()
TriggerRegisterAnyUnitEvent(trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT)
TriggerAddAction(trigger, function()
local caster = GetTriggerUnit()
if GetSpellAbilityId() == FourCC('AHbz') then
local unitGroup = GetUnitsInRangeOfLocMatching(500, GetSpellTargetLoc(), Condition(function()
return GetFilterUnit() ~= caster
end))
ForGroup(unitGroup, function()
local u = GetEnumUnit()
IssueTargetOrder(u, 'attack', GroupPickRandomUnit(unitGroup))
end)
end
end)
end
It works with GetUnitsInRangeOfLoc() but not with the condition. So while trying to figure out why I tried this:
Lua:
function doSth(a,b)
print(a,b)
if b == true then
return a + 1
else
return a
end
end
function sth()
local unit = 1
return doSth(unit, function()
return true
end)
end
print(sth())
where print(a,b) prints the address of function b instead of return value true, why is this happening and how do I fix it?