Mention that script.raise_event raises it instantly

Place to report issues and suggest improvements to the API documentation.
User avatar
PennyJim
Long Handed Inserter
Long Handed Inserter
Posts: 87
Joined: Wed Jan 18, 2023 3:49 am
Contact:

Mention that script.raise_event raises it instantly

Post by PennyJim »

I personally think it's fairly obvious that it would raise it instantly, but it doesn't hurt to be explicit about it.

So my little snippet of code doing this works fine

Code: Select all

local flag = false

function some_func()
	flag = true
	script.raise_event("my-event", {})
	flag = false
end

function other_func()
	if not flag then error("This can only be called during my-event") end
	-- stuff
end
User avatar
PennyJim
Long Handed Inserter
Long Handed Inserter
Posts: 87
Joined: Wed Jan 18, 2023 3:49 am
Contact:

Re: Mention that script.raise_event raises it instantly

Post by PennyJim »

And while we're talking about it. It doesn't mention that there's a prototype for CustomEvent that adds another avenue making a valid event to throw.
Post Reply

Return to “Documentation Improvement Requests”