-
Notifications
You must be signed in to change notification settings - Fork 159
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
Feat(LuaEngine): Add FormatQuery to all method sending message #247
Conversation
I don't really see any benefit over using string.format in these cases |
@Kaev can you think of an example for this with the existing implementation? |
This should work for basically every case (and even more when it comes to formatting decimal and floating point numbers), not just in a handful of functions where it might be implemented or not like the suggested solution. Official Lua docs: https://www.lua.org/pil/20.html |
I know it exists, but it's for the same purpose as WorldDBQuery / WorldDBExecute, to add a certain quality of life :) |
I don't know your query PR (and i also just stumbled upon this PR by accident) but the main reason for parameterized queries is usually security (prevent SQL injections) and performance (query caching). If that is not provided, it should be reverted and reworked IMO. I totally understand where you're coming from with this PR but just for the sake of maintainability, the project shouldn't bloat up with unneccessary stuff like this, especially if that feature already exists in a similar way. That's the main reason why it's harder and just way more work to integrate AC and/or Eluna for AC in other tooling (like the modding framework TSWoW to name one big example). In the end it's just my personal opinion and the project owners decision. Do with it what you want but don't forget that every addition also needs to get maintained sooner or later. |
But I understand the arguments, there's no point in constantly reinventing the wheel, I see it as quality of life for developers.
That's why I'm working on a version of TSWow for AzerothCore :) |
So what's the point? Do I delete this PR or not? What exactly do you want to do ? @Kaev |
I'm not affiliated to the project, don't ask me. I just shared my opinion why i wouldn't bloat the project up with this. |
Thanks for the input. With the information currently available, I don't see the advantage over the existing possibilities. |
📝 Description
This PR introduces
Eluna::FormatText
, a new utility function that allows dynamic text formatting for various message-related methods likeSendSysMessage
,SendNotification
, andSendWorldMessage
. This function replaces{}
placeholders with provided arguments, improving flexibility and readability.Changes
Eluna::FormatText
: Handles string interpolation dynamically.SendSysMessage
,SendNotification
,SendWorldMessage
, etc.) to support formatted arguments.🆕 Modified Methods Overview
1.
SendNotification()
Send Notification to player
Example
2.
SendWorldMessage()
Send Mesage to All Player
Example