Created
August 19, 2014 21:03
-
-
Save ajacksified/440b050e909c3fcbe75c to your computer and use it in GitHub Desktop.
breakup.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ 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