Skip to content
User Avatar
#3684
Auto-translated
}{0TT@6bI4
Jewilly, there is a way to pass all the necessary data to the callback using upvalues:
function test()
  local importantValue = random(10)
  Trigger(4, "TestObject", "ImportantFunc")
  ImportantFunc = function(hero, obj)
    local value = %importantValue
    print(hero, obj, value)
  end
end
--This way, we pass the two original arguments + the important value from the parent function to the callback.
Oh, thank you very much. I tried everything myself, but I forgot about upvalues – I wasn't using them at the time when I started to understand things. I'll keep that in mind!


Не уходи безропотно во тьму,
Будь яростней пред ночью всех ночей,
Не дай погаснуть свету своему!

Хоть мудрый знает – не осилишь тьму
Во мгле словами не зажжёшь лучей –
Не уходи безропотно во тьму.