Skip to content

Commit

Permalink
Release - 1.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuh4 committed Jun 17, 2024
1 parent 84a3d35 commit 0accfeb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions _build/Noir.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3860,18 +3860,22 @@ function Noir.Callbacks:_InstantiateCallback(name, hideStartWarning)

-- For later
local event = Noir.Callbacks.Events[name]
local eventAlreadyExists = event ~= nil -- If the event already exists, _ENV[name] will also exist unless the user does something stupid - but that's on them

-- Create event if it doesn't exist
if not event then
event = Noir.Libraries.Events:Create()
self.Events[name] = event
end

-- Stop here if the event already exists
if event then
return event
end

-- Create function for game callback if it doesn't exist. If the user created the callback themselves, overwrite it
local existing = _ENV[name]

if existing and not eventAlreadyExists then
if existing then
-- Inform developer that a function for a game callback already exists
Noir.Libraries.Logging:Warning("Callbacks", "Your addon has a function for the game callback '%s'. Noir will wrap around it to prevent overwriting. Please use `Noir.Callbacks:Connect(\"%s\", function(...) end)` instead of `function %s(...) end` function to avoid this warning.", name, name, name)

Expand All @@ -3880,7 +3884,7 @@ function Noir.Callbacks:_InstantiateCallback(name, hideStartWarning)
existing(...)
event:Fire(...)
end
elseif not eventAlreadyExists then
else
-- Create function for game callback
_ENV[name] = function(...)
event:Fire(...)
Expand Down Expand Up @@ -4058,7 +4062,7 @@ end
The current version of Noir.<br>
Follows [Semantic Versioning.](https://semver.org)
]]
Noir.Version = "1.8.2"
Noir.Version = "1.8.3"

--[[
This event is called when the framework is started.<br>
Expand Down

0 comments on commit 0accfeb

Please sign in to comment.