function main(modulePath,functionName) -- try to find the module local module = require(modulePath) if type(module) ~= "table" then error(CSVErrors.ImproperLuaModule) end -- try to locate the function -- if there is a metatable on the module, this could return the result of __index -- whether that is a function or something else. local func = module[functionName] if not func then error(CSVErrors.FunctionNotFound) end return func end