- Notifications
You must be signed in to change notification settings - Fork29
Hetu is a lightweight scripting language written in Dart for embedding in Flutter apps.
License
hetu-script/hetu-script
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A lightweight scripting language written in Dart for embedding in Flutter apps.
Hetu is a lightweight scripting language purely written in Dart for embedding in Flutter apps. Our goal is to enable Flutter app & game to have hotfix and scripting ability.
- Modern programming language syntax likes typescript/kotlin/swift, need very little time to get familiar with.
- Full scripting language abilities: class OOP, prototype OOP, FP, module, errors, etc.
- Runs on all platforms that flutter supports, including web browsers and desktop.
- Extremely easy on binding, call Dart functions in script or call script functions in Dart with just one line.
Test Hetu script in the onlineplayground.
To eval a string literal of Hetu code in Dart.
import'package:hetu_script/hetu_script.dart';voidmain() {final hetu=Hetu(); hetu.init(); hetu.eval(r''' var ht = { name: 'Hetu', greeting: () { print('Greetings from ${this.name}!') } } ht.greeting() ''');}
To pass a Map to script, modify it in script and get it back:
import'package:hetu_script/hetu_script.dart';voidmain() {final hetu=Hetu(); hetu.init(externalFunctions: {'hello': ()=> {'greetings':'greetings from Dart!'}, });var hetuValue= hetu.eval(r''' external function hello var dartValue = hello() dartValue['reply'] = 'Hi, this is Hetu.' dartValue // the script will return the value of it's last expression ''');print('hetu value: $hetuValue');}
You can check thedocumentation for more information on thegrammar andbinding.
If you are using VS Code, you can downloadthis extension to get basic highlight and dart snippets on bindings.
We have a command line REPL tool for quick testing. You can activate by the following command:
dart pub global activate hetu_script_dev_toolsThen you can use command line tool 'hetu' in any directory on your computer.
More information about the command line tool can be found by enter 'hetu -h'.
If no arguments is provided, enter REPL mode.
In REPL mode, every exrepssion you entered will be evaluated and print out immediately.
If you want to write multiple line in REPL mode, use '\' to end a line.
>>>vara=42null// repl print>>>a42// repl print>>>functionmeaning{\returna}null// repl print>>>meaningmeaning()->any// repl print>>>hello()42// repl print
You can check thisofficial document for more information on 'pub global activate'.
Discord:https://discord.gg/aJedwcRPr8
中文交流可以加 QQ 群:812529118
You can support my project by simply giving it a star on GitHub.
Or you can buy me a coffee:
About
Hetu is a lightweight scripting language written in Dart for embedding in Flutter apps.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Contributors7
Uh oh!
There was an error while loading.Please reload this page.

