Originally Posted by inDef
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...