package org.hecl.playground;import org.hecl.Command;import org.hecl.HeclException;import org.hecl.Interp;import org.hecl.LongThing;import org.hecl.Thing;/** * Return an ObjectThing for the given variable name which is passed as StringThing. * * Useful when using lists which ObjectThings * * @author Alexander Futász */public class ObjGetCmd implements Command { private static final String CMDNAME = "objget"; private static ObjGetCmd cmd = new ObjGetCmd(); public static void load(Interp ip) { ip.addCommand(CMDNAME, cmd); } public static void unload(Interp ip) { ip.removeCommand(CMDNAME); } public Thing cmdCode(Interp interp, Thing[] argv) throws HeclException { Thing t = null; if (argv.length > 1) { String var = argv[1].toString(); t = interp.getVar(var.substring(1)); } return t == null ? LongThing.create(0) : t; }}