When does the timezone change occur ? And when should you detect it ?
As long as they don't change it during a playing session, calculing the delta a load time is sufficient.
- Curse Premium
Member for 11 years, 3 months, and 12 days
Last active Thu, Sep, 12 2019 17:20:59
- 1 Follower
- 2,404 Total Posts
- 0 Thanks
Jun 23, 2013What about this ?Posted in: Lua Code Discussion
-- Calculate the timezone offset from time(), which should fixed for a given client local now = time() local delta = time(date("!*t", now)) - now -- Calculate the UTC time, based on time() function utc_time() return time() - delta end
The table is used once at initialization.
Jun 7, 2013Adirelle posted a message on Unable to check out AceConsole and AceEvent as externalsAFAIK, the packager only uses the .pkgmeta file. It doesn't rely on other files and it doesn't directly use the svn:externals property (which wouldn't work with git repository anyway). However, it does use the standard svn tools. So when it gets your addon sources for packaging, it pulls the externals. I'm not sure about what happens if the libraries are listed in the .pkgmeta file too.Posted in: Need Help?
Jun 3, 2013Given that all the GM chat thingy is still in the FrameXML, it's quite possible the in-game browser signals itself as such (using the User-Agent HTTP header), so they can identify these tickets and answer accordingly.Posted in: Lua Code Discussion
I agree that's still a problem for people with considerable visual impairments.
May 31, 2013Posted in: Lua Code DiscussionQuote from myrroddinI'm confused. Is Blizzard using Chrome as its in-game help browser? Why are they not using something they wrote, or the OS's built-in browser, be it Safari or Internet Explorer?
I am using Chrome for Windows right now; Firefox has become a bloated mess and Internet Explorer is a great way to get hacked. Chrome is lacking in several ways, but that is definitely off topic.
I think they actually use a Chromium-based browser and not Chrome. The former is open-source (BSD license) and cross-platform. This makes sense to me :
- they can integrate it in their project building process, be it for Windows, MacOS or Linux,
- they don't have to cope with every quirks of every system browsers,
- and they probably remove the features they don't want at compilation time.
By the way, not using Internet Explorer seems a win for me. Does anyone remember when computers were infected by some malicious ads because the Curse Client uses IE for rendering them ?
May 30, 2013Adirelle posted a message on Inline Aura - display aura information inside action buttonsPosted in: General AddOnsQuote from NathanyelCan IA track by ID only?
It doesn't right now. Historically, there was no way to track (de)buffs by ID. This has been added in Cataclysm. But, alas, all IA configuration (built-in and user-defined) uses one ID to get the name for all variants of a (de)buff. Switching to an ID-only configuration would require to list all ID in the default settings and they would be some issues in some cases (macros and items).
May 30, 2013Some core review :Posted in: Libraries
contains, find_first_of, find_last_of, find_if create a new table, assign it to r, but never use nor return it.
find_first_of, find_last_of could be implemented by creating a map out of ... (with true as a value) instead of using contains. The result would be in o(n) instead of o(n²).
Moreover, this :
local len = #list for i = 1, len do local v = list[i]
could be written as the more idiomatic form :
for i, v in ipairs(list) do
Some functions could also apply to maps as way as lists by using "for k, v in pairs(list) do" in their loops.
And lastly, there is no need for :
local len = #list for i = s, len do
for arguments are evaluated only once, so it is equivalent for this, which is more idiomatic :
for i = s, #list do
May 20, 2013Posted in: General ChatQuote from PhanxThe rewards are a nice bonus, but are completely incidental.
Though I originally code addons to "scratch my itches", the author's reward is a nice bonus too and incidentally pays my subscription, my last computer and my wife and I are going in holiday to Rome this year. :-) However, as I seldom play now, finding some motivation to maintain my addons gets harder, maybe because my itches scratch less than before...
May 3, 2013Adirelle posted a message on :SetShown("n") (and similar methods) evaluates falseI've done some quick tests, that show that "n", "N" (actually any string starting with "n", lke "no"), 0, "0", 0.0, "f", "F" (actually any string starting with "f", like "false"), false and nil are considered false and anything else is considered true.Posted in: Lua Code Discussion
May 2, 2013Adirelle posted a message on "Convention" for certain commonly hooked functions?IIRC, AceEvent uses only one frame to handle all events. This was beneficial when Blizzard's event dispatching code was awful with too many frames. Anyway, AceEvent-3.0 is just a thin layer on top of CallbackHandler.Posted in: Lua Code Discussion
May 2, 2013Adirelle posted a message on :SetShown("n") (and similar methods) evaluates falseIt is probably the way "boolean values" (not the boolean type of Lua) are handled by Blizzard C code. It probably also handles 0 as false, even though 0 yields true in Lua.Posted in: Lua Code Discussion
Apr 26, 2013Adirelle posted a message on Best Lua coding practise for continuously called functionsStrings are allocated in the heap and freed by the garbage collector. However, if the computation returns a string that is already in use, it returns the existing string instance instead of creating a new one. However this is totally transparent for the programmer, and unless your function creates a lot of unique strings, you should not care about it.Posted in: Need Help?
Moreover, explicitly cleaning up local variables has no effect, as leaving their scope has the same effect.
- To post a comment, please login or register a new account.