Skip to content

Instantly share code, notes, and snippets.

@ajacksified
Created August 19, 2014 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajacksified/440b050e909c3fcbe75c to your computer and use it in GitHub Desktop.
Save ajacksified/440b050e909c3fcbe75c to your computer and use it in GitHub Desktop.
breakup.lua
--[[ old style ]]
-- init.lua
env.mj = { }
env.mj.doThing = function(sp)
print("did " .. op .. "on env" .. env.name)
end
--[[ new style ]]
-- init.lua
env.mj = require('mj')(env)
--mj.lua
return function(env)
local doThing = function(op)
print("did " .. op .. "on " .. env.name)
end
return {
doThing = doThing
}
end
-- test.lua
local env = { name = 'stub' }
env.mj = require('mj')(env)
describe('mj', function() --[[ ... ]] end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment