added new getepoch func and made call more generic

This is a common idiom in Lua.