Thread: Window Chaining
View Single Post
03/07/14, 11:58 AM   #8
Lodur
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 108
Originally Posted by inDef View Post

So going back to the CHAIN function, when exactly do all of the returned functions in the chain get executed?
Code:
  CFP.TLW = CFP.BallAndChain( 
      WINDOW_MANAGER:CreateTopLevelWindow("CFP_BuffDisplay") )
    -- Return T
    -- Returns T, where T has the __index function on it's meta table built

    :SetHidden(true)
    -- step 1) lookup SetHidden via __index:
    -- return function( self , ... )
    -- tmp = T.__index(T, SetHidden) -- 1st anon function runs and returns the 2nd anon function

    -- Step 2) invoke function call:
    -- return self
    -- :tmp(true)  -- calls 2nd anon function which calls SetHidden on object and returns self (i.e. T)


    :SetDimensions(w,h)
    -- step 1) lookup SetDimensions via __index:
    -- return function( self , ... )
    -- tmp = T.__index(T, SetDimensions) -- 1st anon function runs and returns the 2nd anon function

    -- Step 2) invoke function call:
    -- return self
    -- :tmp(w,h)  -- calls 2nd anon function which calls SetDimensions on object and returns self (i.e. T)

  .__BALL
  -- step 1) lookup __BALL via __index:
  -- if func == "__BALL" then	return object end
  -- 1st anon function string matches __BALL names and then returns object.
  -- There is not invoke function call step as there are no parens after __BALL.
That is my understanding, at least...

Last edited by Lodur : 03/07/14 at 12:02 PM.
  Reply With Quote