So I think I got it. I did have to use 0 and 1, btw. Using true/false wouldn't set.
I don't know why?
Final code:
objname={}
g_runonce={}
function teststuff_init(e)
g_runonce[e] = 0
end
function teststuff_init_name(e, name)
objname[e] = name
end
function teststuff_main(e)
if g_runonce[e] == 0 or g_runonce[e] == nil then
customfunction(objname[e])
g_runonce[e] = 1
end
end