diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2018-10-29 08:35:53 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2018-10-29 08:35:53 +0000 |
| commit | 27d1cf641ce3bbfe96e6fe18f24dd46f95efbe5e (patch) | |
| tree | ac703b9f84c1c8e4666d039a880a2af91c450c4a /lib/init.server.moon | |
| parent | move duct_tape to lib (diff) | |
| download | mmm-27d1cf641ce3bbfe96e6fe18f24dd46f95efbe5e.tar.gz mmm-27d1cf641ce3bbfe96e6fe18f24dd46f95efbe5e.zip | |
better conversion inverence for mmmfs
Diffstat (limited to 'lib/init.server.moon')
| -rw-r--r-- | lib/init.server.moon | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/init.server.moon b/lib/init.server.moon index a91bd52..f81a2dc 100644 --- a/lib/init.server.moon +++ b/lib/init.server.moon @@ -1,9 +1,27 @@ -export MODE, warn, relative, append, on_client +export MODE, print, warn, relative, append, on_client MODE = 'SERVER' +deep_tostring = (tbl, space='') -> + buf = space .. tostring tbl + + return buf unless 'table' == type tbl + + buf = buf .. ' {\n' + for k,v in pairs tbl + buf = buf .. "#{space} [#{k}]: #{deep_tostring v, space .. ' '}\n" + buf = buf .. "#{space}}" + buf + +print = do + _print = print + (...) -> + contents = [deep_tostring v for v in *{ ... } ] + _print table.unpack contents + -- warning messages warn = (...) -> - io.stderr\write table.concat { ... }, '\t' + contents = [deep_tostring v for v in *{ ... } ] + io.stderr\write table.concat contents, '\t' io.stderr\write '\n' -- relative imports |
