# HG changeset patch # User Daniel Poelzleithner # Date 1286238844 -7200 # Node ID 1cd9e69b85cb7f70b7bd488c6d04562d700f692e # Parent 6e08067e66c1e136b4573452ecb939d9f2a31a75 add execute.load_chunk(args) load_chunk loads the content of a lua file and returns the code. It can construct the path name easily so you can put helper code in seperate files for DRYness. diff -r 6e08067e66c1 -r 1cd9e69b85cb framework/env/execute/load_chunk.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/framework/env/execute/load_chunk.lua Tue Oct 05 02:34:04 2010 +0200 @@ -0,0 +1,32 @@ +--[[-- +status_code = -- executes and returns a lua file +execute.load_chunk{ + file_path = file_path, -- path to a lua source or byte-code file + app = app, -- app name to use or the current will be used + module = module, -- module where chunk is located + chunk = chunk -- filename of lua file to load +} + +This function loads and executes a lua file specified by a given path or constructs +a path to load from the module and chunk name. + +--]]-- + +function execute.load_chunk(args) + local file_path = args.file_path + local app = args.app + local module = args.module + local chunk = args.chunk + + app = app or request.get_app_name() + + file_path = file_path or encode.file_path(request.get_app_basepath(), + 'app', app, module, chunk) + + local func, load_errmsg = loadfile(file_path) + if not func then + error('Could not load file "' .. file_path .. '": ' .. load_errmsg) + end + local result = func() + return result +end diff -r 6e08067e66c1 -r 1cd9e69b85cb framework/env/trace/_render_sub_tree.lua --- a/framework/env/trace/_render_sub_tree.lua Mon Sep 20 20:11:29 2010 +0200 +++ b/framework/env/trace/_render_sub_tree.lua Tue Oct 05 02:34:04 2010 +0200 @@ -35,6 +35,18 @@ open("debug") slot.put(encode.html(node.message)) close() + elseif node_type == "debug_table" then + open("debug") + slot.put("") + if type(node.message) == "table" then + for k, v in pairs(node.message) do + slot.put("") + end + slot.put("
", encode.html(tostring(k)),"", encode.html(tostring(v)), "
") + else + slot.put("debug_table: not of table type") + end + close() elseif node_type == "traceback" then open("debug") slot.put('
')