summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2007-05-31 14:23:49 +0000
committerpixel <pixel>2007-05-31 14:23:49 +0000
commit6b03bfe304eea5cc7122772be862cf0eeaf1c6ca (patch)
tree1ef2f3afc23efa353d77a9559a04d51f44c2d89c /lib
parent0743b52c2756e2aef71deea4cc9d5c8a71b640c5 (diff)
Tweaking the display function a bit to dump tables as well.
Diffstat (limited to 'lib')
-rw-r--r--lib/supportlib.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/supportlib.lua b/lib/supportlib.lua
index 2dc26f2..4d2d2dc 100644
--- a/lib/supportlib.lua
+++ b/lib/supportlib.lua
@@ -19,12 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: supportlib.lua,v 1.4 2007-05-30 11:57:10 pixel Exp $ */
+/* $Id: supportlib.lua,v 1.5 2007-05-31 14:23:49 pixel Exp $ */
]]--
--
--- Dumps a file to the screen.
+-- Dumps a file or a table to the screen.
--
function display(inp, n)
@@ -35,9 +35,15 @@ function display(inp, n)
error("Display needs a string or an Input object")
end
+ if inp.__objtype ~= "Handle" then
+ local t = inp
+ inp = Buffer()
+ dumpvars(inp, t, "table")
+ end
+
i = 0
- while(not inp:isclosed()) do
+ while (not inp:isclosed()) do
i = i + 1
print(inp:read())
if ((n ~= nil) and (i >= n)) then