From 855fe23439bbcf3b1cb8a8798d055cb30fb610c1 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 27 Jan 2018 16:39:56 -0800 Subject: Tweaked code to not rely on moonscript. --- nomsu.moon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nomsu.moon') diff --git a/nomsu.moon b/nomsu.moon index e2e2f10..a42e2e9 100755 --- a/nomsu.moon +++ b/nomsu.moon @@ -1006,7 +1006,8 @@ if arg -- TODO: properly print out the calling site of nomsu code, not just the *called* code - import to_lua from require "moonscript.base" + ok, to_lua = pcall -> require('moonscript.base').to_lua + if not ok then to_lua = -> nil nomsu_file = io.open("nomsu.moon") nomsu_source = nomsu_file\read("*a") _, line_table = to_lua(nomsu_source) @@ -1038,7 +1039,7 @@ if arg else if calling_fn.istailcall and not name name = "" - if calling_fn.short_src == "./nomsu.moon" + if calling_fn.short_src == "./nomsu.moon" and line_table char = line_table[calling_fn.currentline] line_num = 1 for _ in nomsu_source\sub(1,char)\gmatch("\n") do line_num += 1 -- cgit v1.2.3