It works exactly the same as in xml.
Code:
local a = CreateFrame("Frame", "MyFrame", UIParent)
local b = CreateFrame("Button", "$parentButton", a)
local c = b:CreateTexture("$parentTexture", "OVERLAY")
a) MyFrame
b) MyFrameButton
c) MyFrameButtonTexture
EDIT: Maybe I misunderstood your question.. leaving it anyway. :P