2023-05-14 10:39:43 +08:00
|
|
|
import _pika_lua
|
|
|
|
|
|
|
|
"""
|
2023-05-14 10:43:02 +08:00
|
|
|
PikaPython lua auto binging module
|
|
|
|
|
|
|
|
- Import lua module as a python module
|
2023-05-14 10:39:43 +08:00
|
|
|
|
|
|
|
``` python
|
|
|
|
import pika_lua
|
|
|
|
|
|
|
|
# import lua module as a python module
|
|
|
|
lua_math = pika_lua.require("math")
|
|
|
|
|
|
|
|
# get vars from lua module
|
|
|
|
print(lua_math.pi)
|
|
|
|
|
|
|
|
# call lua function
|
|
|
|
print(lua_math.sin(1))
|
|
|
|
```
|
|
|
|
|
2023-05-14 10:43:02 +08:00
|
|
|
- Eval lua code
|
2023-05-14 10:39:43 +08:00
|
|
|
|
|
|
|
``` python
|
|
|
|
import pika_lua
|
|
|
|
|
|
|
|
# eval lua code
|
|
|
|
print(pika_lua.eval("print(1 + 1)"))
|
2023-05-14 10:43:02 +08:00
|
|
|
```
|
2023-05-14 10:39:43 +08:00
|
|
|
"""
|
|
|
|
|
|
|
|
def eval(cmd: str):
|
|
|
|
return _pika_lua.eval(cmd)
|
|
|
|
|
|
|
|
def evalLine(line: str):
|
|
|
|
return _pika_lua.evalLine(line)
|
|
|
|
|
|
|
|
def require(module: str):
|
|
|
|
return _pika_lua.require(module)
|