View Single Post
02-23-17, 08:01 AM   #9
kurapica.igas
A Chromatic Dragonspawn
Join Date: Aug 2011
Posts: 152
Originally Posted by Layback_ View Post
So, you are saying that PLoop and Scorpio could still be embedded like other libraries, but is not recommended due to its file size. Am I getting it right?
Not only the file size, the Scorpio also need to be standalone, so it can provide features like save locations and other settings for other addons. A simple example in its UI system:

Lua Code:
  1. Scorpio "TestFrame" ""
  2.  
  3. import "Scorpio.UI"
  4.  
  5. f = Frame("TestFrame")
  6.  
  7. -- Load it's previous location by the Scorpio, the wow only handle frame with global names,
  8. -- in the Scorpio, UI core has provide a way to give every ui elements a unique mark, so
  9. -- it'll work for frames without global names.
  10. f:SetUserPlaced(true)

Also, with current release of Scorpio (non-UI parts), I can make UIs in pure Lua, but logics in Scorpio, can't I?
Yes, in the trilliax-scrubber, it use ACEGUI to create control panels.

Last but not least, if possible could you please briefly explain some advantages of using PLoop and Scorpio over pure lua?

As a C++ & Java studied person, I am glad to see OOP style coding in Lua.
(Well... I know there were some OOP plugins existed from the past, but most of them are outdated or not easy to follow, and they were basically not for WoW)

But, also would like to know how efficient it would be (like pros and cons).

Thanks!

P.S: Sorry if I am taking too much of your time
The OOP system cause more memory usage to store the definitions, and the usage of the meta-methods also would cause the operations on the objects would be slower than the raw-tables.

But object accessing is few in an addon, as you can see in the Scorpio, normally all codes are defined in the functions with simple lua datas, you won't face many objects in the non-ui part.

For the UI part, the ui elements created from CreateFrame also use meta-method to access it's api like frm:SetPoint(), so the cost is all the same with the Scorpio's objects.

Besides the efficiency of running,I care more about the efficiency of development and the code style.

Take one line code from the trilliax-scrubber(I hope DevSkamer don't mind) :

Lua Code:
  1. local explodingList = self.scrubbers:Filter("k,v=>v.isExploding").Values:ToList():Sort("x,y=>x.startExploding<y.startExploding")

Convert it to pure lua

Lua Code:
  1. local explodingList = {}
  2.  
  3. for k, v in pairs(self.scrubbers) do
  4.     if v.isExploding then
  5.         tinsert(explodingList, v)
  6.     end
  7. end
  8.  
  9. table.sort(explodingList, function(x,y) return x.startExploding < y.startExploding end)

Maybe it's not a good example, but I think you may find the first one will be more clear when you look it back after several times.

Last edited by kurapica.igas : 02-23-17 at 08:05 AM.
  Reply With Quote