30 lines
556 B
Python
30 lines
556 B
Python
"""
|
|
Rhai Python Bindings
|
|
|
|
Python bindings for the Rhai scripting language.
|
|
"""
|
|
|
|
from .rhai_python import RhaiEngine, __version__
|
|
|
|
__all__ = ["RhaiEngine", "__version__"]
|
|
|
|
|
|
# Convenience function for quick evaluation
|
|
def eval(script: str):
|
|
"""
|
|
Evaluate a Rhai script and return the result.
|
|
|
|
Args:
|
|
script: The Rhai script to evaluate
|
|
|
|
Returns:
|
|
The result of the script evaluation
|
|
|
|
Example:
|
|
>>> import rhai
|
|
>>> rhai.eval("40 + 2")
|
|
42
|
|
"""
|
|
engine = RhaiEngine()
|
|
return engine.eval(script)
|