From 3c02b8646fcef43169c08e478f2e98f09837ca72 Mon Sep 17 00:00:00 2001 From: Jess Balint Date: Fri, 8 Jul 2016 16:25:17 -0500 Subject: [PATCH] allow import() to take a class name as a string (for weird package names, etc) --- debuglib.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/debuglib.lua b/debuglib.lua index a455795..9b8b9ce 100644 --- a/debuglib.lua +++ b/debuglib.lua @@ -244,6 +244,7 @@ function bp(method, line_num) error("Invalid method, must be method declaration of form \"pkg/Class.name()V\" or a jmethod_id object") end + --b.location = line_num -- TEMP to use raw offset --method_location_for_line_num(b.method_id, b.line_num) b.location = method_location_for_line_num(b.method_id, b.line_num) if b.location < 0 then b.location = 0 @@ -626,6 +627,9 @@ function import(class) if type(class) == "table" and class.classname == "jclass" then _ENV[class.getSimpleName().toString()] = class return class + elseif type(class) == "string" then + cl = jclass.find(class:gsub("%.", "/")) + return import(cl) else error("Not a valid class") end