Mention that script.raise_event raises it instantly

Place to report issues and suggest improvements to the API documentation.
User avatar
PennyJim
Fast Inserter
Fast Inserter
Posts: 131
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
Fast Inserter
Fast Inserter
Posts: 131
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.
User avatar
PennyJim
Fast Inserter
Fast Inserter
Posts: 131
Joined: Wed Jan 18, 2023 3:49 am
Contact:

Re: Mention that script.raise_event raises it instantly

Post by PennyJim »

PennyJim wrote: Thu Dec 05, 2024 11:54 pm And while we're talking about it.
Yeah, just bury it in this lesser improvement request past me...

Made a proper separate request for it: 130565
Post Reply

Return to “Documentation Improvement Requests”