Promise design-pattern in Lua