t1 = { { attr = "out" }, } t2 = { somefunc = function() print( "hi" ) end } t3 = { out = t2.somefunc } t3[t1[#t1].attr]()