- Registered User
Member for 12 years, 7 months, and 11 days
Last active Tue, Oct, 30 2018 22:06:50
- 0 Followers
- 866 Total Posts
- 0 Thanks
Jan 2, 2011The addon Skinner written by jncl has been known to break _G in the past. It wasn't it wasn't a complete breakage by removing it but he changed it enough to cause strange unidentifiable errors in other addons. That's why most of us that were around at that time use local _G = getfenv(0) instead of local _G = _G.Posted in: Lua Code Discussion
Nov 24, 2010Posted in: Lua Code DiscussionQuote from PhanxThe correct way to determine whether you are in a party is to check if GetNumPartyMembers() > 0. If you need to also check that you're not in a raid group, you would want to additionally check that GetNumRaidMembers() == 0.
The correct way is with GetRealNumPartyMembers(), if you just use GetNumPartyMembers() then the code will be incorrect while you are inside a battleground. This is the major cause of the "You are not in a party spam.", people using the incorrect one.
Oct 15, 2010Posted in: General ChatQuote from DaedhirFor instance, if somebody takes your software and modifies it, they have to explicitly state that they've done so, and if they don't they have violated the license and thus have no rights whatsoever to your software. You can issue take down notices for this reason, and many others.
So when the WoWMatrix debacle was going on, I'm absolutely sure that the SFLC would have been happy to help any GPL developers regain full rights to their own code.
Speaking as the person that pulled WoWMatrix source code out of memory while it was running and posted that code up on the WoW forums during my crusade against WoWMatrix. WoWMatrix did not redistribute modified addons. They provided the original addons but then their installer would patch the addons after installing them without notification. One of the majorly controversial ones was that it was removing the copyright notices from Carbonite.
I don't believe there is anything to stop that kind of behavior when using a non restrictive license which is why some of us that were using open source licenses changed to restrictive licenses.
Sep 11, 2010The only extra file in a properly setup repo for a library will be the TOC file so adding extra directories is a waste and from my experience a complete PITA. Just look at LibSharedMedia-3.0 and how fucked up things are because of the extra directory, we can't remove it and we can't remove the top level lib.xml without breaking addons.Posted in: Libraries
Aug 24, 2010Posted in: Lua Code DiscussionQuote from PhanxHow so?
The last one is different because when calling abc() inside of the function you are not calling the function and recursing, you are calling the global abc() function.
Aug 24, 2010Posted in: Lua Code DiscussionQuote from AdirelleNote that this :
local function myFunction(x, y) print("this is x", x, "and this is y", y) end
Is exactly the same as this :
local myFunction = function (x, y) print("this is x", x, "and this is y", y) end
local myFunction function myFunction(x, y) print("this is x", x, "and this is y", y) end
Or even this :
local myFunction myFunction = function(x, y) print("this is x", x, "and this is y", y) end
So you can declare the function name before calling it and define it afterwards.
local myFunction local function anotherFunction() myFunction(5, 6) end function myFunction(x, y) print("this is x", x, "and this is y", y) end
Its been a while but I think you are incorrect.
I'll add some fluff to these examples to give a little context.
local function abc(...) local x = ... print(x) if select('#', ...) >= 2 then abc(select(2,...)) end end
is the same as
local abc function abc(...) local x = ... print(x) if select('#', ...) >= 2 then abc(select(2,...)) end end
but this one is different
local abc = function(...) local x = ... print(x) if select('#', ...) >= 2 then abc(select(2,...)) end end
Yes I'm being a dick about the minor details.
Aug 22, 2010Somebody could create a sticky in this forum with an all caps title like READ THIS BEFORE POSTING and then just delete any threads where the person obviously didnt read it.Posted in: Addon Ideas
I mean seriously the 3 replies to this thread are all from people that could actually create the sticky.....
Aug 2, 2010Posted in: Lua Code DiscussionQuote from OrionShock#table only returns the number of elements in a sequenced index. So if you have something at 1 - 5 & 35, #table is going to return 5 not 6.
Not true, the behavior of #table is considered 'undefined' in the case that the table is anything other than a continuous array of integers without any gaps. It could return 35 in that case or it could return 5.
This is why ipairs() should always be used over 'for i = 1, #table' in iterators if you are expecting the same behavior as ipairs but can not fully trust the source 100% because you did not create the table yourself.
Quote from lilsparkyyeah, that was more for illustration purposes. also, not sure how you sort two tables at the same time using one table as the keys and the other as the values.
Quote from XinhuanYou do this by writing your own sort function (when swapping 2 entries, you perform the swap in both tables). Here, I mean writing the actual sort function, not the comparison function. Shell sort is almost as efficient as quick sort in Lua.
Another more simple option is to just use the original hash table and an additional array that uses the keys from the hash table as its value to act as a sorted reference to the hash table. You use the array first to get the sorted keys but when you need the values you just look them up from the has table. You do have to iterate over the entire hash table though when you want to delete an entry and you can't have more than one entry with the same key like you could using two arrays.
- To post a comment, please login or register a new account.