Just an FYI about loadfile in case you didn't figure it out. It doesn't load like an API. It returns a function whose body is the file (hence the ability to do args = { ... } in a program). The problem is that by default the environment the file runs in is _G. For those of you that don't know what an environment is, a function's environment is where every global it declares or reads is stored. It's typically bad to keep stuff in _G. To change the environment of the function you get from loadfile, you need to use setfenv(func, env). So basically, this is what you're looking for:
myAPIt = setmetatable({}, {__index = getfenv()}) -- create table for API
myAPIf = loadfile("path") -- load API to function
setfenv(myAPIf, myAPIt) -- make function run in the API environment
myAPIf() -- run the API.
myAPIt.func() -- call a function from the API.
Notice that this doesn't load the API for system use. But that's easy just do _G.myAPI = myAPIt