Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce c2.later() function to Lua API. #5154

Merged
merged 8 commits into from
Feb 25, 2024
Merged

Conversation

Mm2PL
Copy link
Collaborator

@Mm2PL Mm2PL commented Feb 5, 2024

It's setTimeout but not exactly.

Example usage:

function cmd_foo(ctx)
  local chn = c2.Channel.by_name(ctx.channel_name, c2.Platform.Twitch)
  chn:add_system_message("Immediate feedback")
  c2.later(function()
     chn:add_system_message("This runs after 1s")
  end, 1000)
end
c2.register_command("/foo", cmd_foo)

Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to miss updates in plugin-meta.lua too

Could you provide some use-case / example in the PR description for later reference?

src/controllers/plugins/LuaAPI.hpp Show resolved Hide resolved
@Mm2PL Mm2PL changed the title Introduce c2.later() Introduce c2.later() function to Lua API. Feb 13, 2024
@pajlada pajlada enabled auto-merge (squash) February 25, 2024 11:21
@pajlada pajlada merged commit a737d4b into master Feb 25, 2024
17 checks passed
@pajlada pajlada deleted the feature/lua-timeout branch February 25, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants