OMG and I LITERALLY noticed it straight after i posted T.T. Well, for your entertainment it was this line in the function I posted
Code:
tab.SetScript("OnClick", Tab_OnClick)
which should be
Code:
tab:SetScript("OnClick", Tab_OnClick)
Now it works!
Almost... I'm still missing all the contents I wish to be shown on the tabs.
EDIT: I figured it out! I forgot a table insert from the SetTabs function, which made it return nil for the PopulateTabs function causing a lua error.