YueScript is a MoonScript dialect. It is derived from MoonScript language 0.5.0 and continuously adopting new features to be more up to date.
MoonScript is a language that compiles to Lua. Since original MoonScript has been used to write web framework lapis and run a few business web sites like itch.io and streak.club with some large code bases. The original language is getting too hard to adopt new features for those may break the stablility for existing applications.
So YueScript is a new code base for pushing the language to go forward and being a playground to try introducing new language syntax or programing paradigms to make MoonScript language more expressive and productive.
Yue (月) is the name of moon in Chinese and it's pronounced as [jyɛ].
YueScript is being developed and maintained alongside the open-source game engine Dora SSR. It has been used to create engine tools, game demos and prototypes, validating its capabilities in real-world scenarios while enhancing the Dora SSR development experience.
Build yue.so
file with
> make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua
Then get the binary file from path bin/shared/yue.so
.
Or you can install luarocks, a package manager for Lua modules. Then install it as a Lua module with
> luarocks install yuescript
Then require the YueScript module in Lua:
require("yue")("main") -- require `main.yue`
local yue = require("yue")
local codes, err, globals = yue.to_lua([[
f = -> print "hello world"
f!
]],{
implicit_return_root = true,
reserve_line_number = true,
lint_global = true
})
Clone this repo, then build and install executable with:
> make install
Build YueScript tool without macro feature:
> make install NO_MACRO=true
Build YueScript tool without built-in Lua binary:
> make install NO_LUA=true
Use YueScript tool with:
> yue -h
Usage: yue [options|files|directories] ...
-h Print this message
-e str Execute a file or raw codes
-m Generate minified codes
-r Rewrite output to match original line numbers
-t path Specify where to place compiled files
-o file Write output to file
-s Use spaces in generated codes instead of tabs
-p Write output to standard out
-b Dump compile time (does not write output)
-g Dump global variables used in NAME LINE COLUMN
-l Write line numbers from source codes
-j Disable implicit return at end of file
-c Reserve comments before statement from source codes
-w path Watch changes and compile every file under directory
-v Print version
-- Read from standard in, print to standard out
(Must be first and only argument)
--target=version Specify the Lua version that codes will be generated to
(version can only be 5.1, 5.2, 5.3 or 5.4)
--path=path_str Append an extra Lua search path string to package.path
Execute without options to enter REPL, type symbol '$'
in a single line to start/stop multi-line mode
Use cases:
Recursively compile every YueScript file with extension .yue
under current path: yue .
Compile and save results to a target path: yue -t /target/path/ .
Compile and reserve debug info: yue -l .
Compile and generate minified codes: yue -m .
Execute raw codes: yue -e 'print 123'
Execute a YueScript file: yue -e main.yue
MIT
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型