From 72f1ba5dfdbe1adad222da8bbcd456b71d21b678 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Fri, 16 Jun 2017 17:04:14 +0200 Subject: [PATCH] Fixed some issues where `pretty` would create new global variables. --- analyze_structure.lua | 2 +- pretty.lua | 2 +- test/tests.lua | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/analyze_structure.lua b/analyze_structure.lua index 0d7f8b4..07a7f7f 100644 --- a/analyze_structure.lua +++ b/analyze_structure.lua @@ -1,7 +1,7 @@ local TABLE_TYPE do - local thispath = ... and select('1', ...):match('.+%.') or '' + local thispath, was_loaded = ... and select('1', ...):match('.+%.') or '' was_loaded, TABLE_TYPE = pcall(require, thispath..'table_type') assert(was_loaded, '[pretty]: Could not load vital library: table_type') end diff --git a/pretty.lua b/pretty.lua index f9e0464..925c169 100644 --- a/pretty.lua +++ b/pretty.lua @@ -300,7 +300,7 @@ local TABLE_TYPE_TO_PAIR_FORMAT = { -- Formatting tables -function format_table (t, depth, l) +local function format_table (t, depth, l) -- TODO: Add more nuanced formatting. -- Error Checking diff --git a/test/tests.lua b/test/tests.lua index d175220..b9a6067 100644 --- a/test/tests.lua +++ b/test/tests.lua @@ -2,6 +2,7 @@ package.path = package.path .. ';./test/?.lua;./src/?.lua' local TEST_SUITE = require("TestSuite").new('pretty') + TEST_SUITE:enableStrictGlobal() TEST_SUITE:addModules('test/test_*') -- TEST_SUITE:generateRequireSubmodule 'require' TEST_SUITE:setOptions(...)