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

refactor: unused varargs #1265

Closed
wants to merge 1 commit into from
Closed

refactor: unused varargs #1265

wants to merge 1 commit into from

Conversation

MoskalykA
Copy link
Contributor

@MoskalykA MoskalykA commented Dec 8, 2023

Hi, I suggest deleting this vararg which seems to be unused

@Gellipapa
Copy link
Contributor

@MoskalykA Hi! What happens if somebody wants to pass some property of the item, or some extra variable that they want to get back in the callback?

function useHealthKit(source, item, healthRestoreAmount)
    print("Health kit used by player " .. source .. ". Restores " .. healthRestoreAmount .. " health.")
end

Core.UsableItemsCallbacks["healthkit"] = useHealthKit
ESX.UseItem(123, "healthkit", 50)

@Gellipapa
Copy link
Contributor

So clearly we cannot accept it because we use it.

@MoskalykA
Copy link
Contributor Author

I agree, although I haven't found any use for it (search), otherwise you'd have to use a table rather than a vargarg, and there should be a distinct difference in performance.

@Gellipapa
Copy link
Contributor

Gellipapa commented Dec 10, 2023

I agree, although I haven't found any use for it (search), otherwise you'd have to use a table rather than a vargarg, and there should be a distinct difference in performance.

(SEARCH)
Just because you can't find it in public code doesn't mean that someone isn't using it, so you can't say that no one is.

Yes in the past a table might have been better but now you can still pass a table because of this operator, but if you don't add a table and overwrite or delete it you break the system.

@Gellipapa Gellipapa closed this Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants