private Object createThreadAndInvoke(XValue method, int stepsToExecute,
			XValue thiz, XValue... args) throws ScriptException {
		XObjectDataFunc func = XUtils.getDataAs(this, method,
				XObjectDataFunc.class);
		String[] params = func.getParamNames();
		if (params.length != args.length)
			throw new IllegalArgumentException();
		XExec exec = new XExec(this, false, 128, method, thiz, args);
		threads.add(exec);
		int instrs;
		if (stepsToExecute != -2) {
			instrs = stepsToExecute;
		} else {
			instrs = (Integer) get(XScriptLang.ENGINE_ATTR_INSTS_TO_RUN_ON_DIRECT_INVOKE);
		}
		if (running)
			exec.run(instrs);
		State state = exec.getState();
		if (state == State.TERMINATED) {
			XValue ret = exec.pop();
			threads.remove(exec);
			return ret;
		} else if (state == State.ERRORED) {
			XValue exception = exec.getException();
			threads.remove(exec);
			XUtils.throwException(this, exception);
		}
		if ((Boolean) get(XScriptLang.ENGINE_ATTR_TIMEOUT_DIRECT_INVOKE)) {
			throw new XScriptException(new TimeoutException());
		}
		return null;
	}