Skip to content

wait_for in coroutine helper doesn't accept 'nil' as a valid function argument

@stdgregwar

This code doesn't work:

wait_for(hero.start_treasure, hero, "id_card", 2, nil)

It says:

Error: In dialog callback: scripts/coroutine_helper.lua:83: scripts/coroutine_helper.lua:170: bad argument #\4 to method (string expected, got function))

Meanwhile, this does the trick:

wait_for(hero.start_treasure, hero, "id_card", 2, "")

I think it's because wait_for is skipping that nil at the end, and inserting the callback there. But sometimes we want to explicitly pass nil as an argument.

Related: voadi/voadi#265 (closed)

Edited by Alex Gleason
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information