update moon library to not use module

This commit is contained in:
leaf corcoran 2013-06-07 23:34:03 -07:00
parent e65ac4946d
commit 2f4066d9bb
4 changed files with 32 additions and 20 deletions

View File

@ -1,3 +1,5 @@
moon = moon or { }
moon.inject = true
return require("moon.init")
local moon = require("moon")
for k, v in pairs(moon) do
_G[k] = v
end
return moon

View File

@ -1,8 +1,6 @@
-- insert all moon library functions into requiring scope
export moon
moon = moon or {}
moon.inject = true
require "moon.init"
-- install moon into global scope
moon = require "moon"
for k,v in pairs moon
_G[k] = v
moon

View File

@ -1,11 +1,9 @@
if not moon or not moon.inject then
module("moon", package.seeall)
end
local util = require("moonscript.util")
local lua = {
debug = debug,
type = type
}
local dump, p, is_object, type, debug, run_with_scope, bind_methods, defaultbl, extend, copy, mixin, mixin_object, mixin_table, fold
dump = util.dump
p = function(...)
return print(dump(...))
@ -161,4 +159,19 @@ fold = function(items, fn)
return items[1]
end
end
return nil
return {
dump = dump,
p = p,
is_object = is_object,
type = type,
debug = debug,
run_with_scope = run_with_scope,
bind_methods = bind_methods,
defaultbl = defaultbl,
extend = extend,
copy = copy,
mixin = mixin,
mixin_object = mixin_object,
mixin_table = mixin_table,
fold = fold
}

View File

@ -1,12 +1,8 @@
if not moon or not moon.inject
module "moon", package.seeall
util = require "moonscript.util"
lua = { :debug, :type }
export *
local *
dump = util.dump
@ -134,4 +130,7 @@ fold = (items, fn)->
else
items[1]
nil
{
:dump, :p, :is_object, :type, :debug, :run_with_scope, :bind_methods,
:defaultbl, :extend, :copy, :mixin, :mixin_object, :mixin_table, :fold
}