Thanks, I was just getting to something similar - local bin = ffi.load 'd3dx9_43.dll' local math = setmetatable( { test = function() print("test") end }, { __index = function(self, key) return bin[key]; end } ) return math I should try the __index = lib. Slightly cleaner, didn't realize that would work. Kaj