# newLisp 库模块帮助文档

<details>  <summary>官网文档</summary>  <p>
http://www.newlisp.org/
http://www.newlisp.org/newlisp_manual.html
http://www.newlisp.org/CodePatterns-cn.html
</p></details>

## newLisp 成员列表 <a id="newLisp" href="#newLisp">&#x23;</a>

### newLisp.callback(name,proto,func) <a id="newLisp.callback" href="#newLisp.callback">&#x23;</a>

```aardio
newLisp.callback("/*回调函数名，LISP 可用 get-string 等获取返回值*/","string(int,double,string)",  
	function(i,n,str){  
		return JSON.stringify({i,n,str});  
	}  
)
```

### newLisp.eval() <a id="newLisp.eval" href="#newLisp.eval">&#x23;</a>
执行 LISP 代码，返回字符串  

LISP 代码支持 aardio 模板语法: https://www.aardio.com/zh-cn/docs/language-reference/templating/syntax.html   
一、如果 aardio 输出表，则通过 JSON 转为 LISP 对象  
二、如果 aardio 输出多个参数，则转为数组后通过 JSON 转为 LISP 对象  
三、如果 aardio 输出其他单个参数，则转为字符串直接置入 LISP 代码

### newLisp.exec() <a id="newLisp.exec" href="#newLisp.exec">&#x23;</a>
执行 LISP 代码，并输出到控制台  

LISP 代码支持 aardio 模板语法: https://www.aardio.com/zh-cn/docs/language-reference/templating/syntax.html   
一、如果 aardio 输出表，则通过 JSON 转为 LISP 对象  
二、如果 aardio 输出多个参数，则转为数组后通过 JSON 转为 LISP 对象  
三、如果 aardio 输出其他单个参数，则转为字符串直接置入 LISP 代码

### newLisp.jsonCallback(name,proto,func) <a id="newLisp.jsonCallback" href="#newLisp.jsonCallback">&#x23;</a>

```aardio
newLisp.callback("/*回调函数名，LISP 可用 get-json 获取返回值*/","string(int a,int b)",  
	function(a,b){  
		return {a,b};  
	}  
)
```

### newLisp.libConsole(false) <a id="newLisp.libConsole" href="#newLisp.libConsole">&#x23;</a>
禁止 LISP 代码输出到控制台

### newLisp.libConsole(true) <a id="newLisp.libConsole" href="#newLisp.libConsole">&#x23;</a>
允许 LISP 代码输出到控制台，这是默认设置

### newLisp.run() <a id="newLisp.run" href="#newLisp.run">&#x23;</a>
启动 NewLisp REPL（Read Eval Print Loop）命令行解释器  
每一个非空行在回车后执行并输出结果,  
如果输入一个空行，则读取输入直到下一个空行后执行代码  
按Ctrl + C退出程序
