Up to now, the compiler does not have full Lua language support, and there is a variable scope problem, which cannot be used for large-scale projects.
If you can help with the development, please submit a Pull Request.
- Variable defines (basic types)
- Function defines (need define types for arguments)
- Function calls
- print/command functions (use
command("")to execute Minecraft commands) - String combines (two strings one time)
- For in/While/Repeat
- If/Else
- advanced math functions
- better performance
- variable local range ...
on Linux/Mac OS:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txton Windows (PowerShell):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
python -m venv .venv
.venv\bin\activate.ps1
pip install -r requirements.txtyou need to delete print(val) to remove the debug output.
( at .venv/lib/python3.*/site-packages/luaparser/ast.py line 37)
Build with:
# Compile *.lua to a datapack
# This toll won't zip the datapack, it only output a directory
python datapack.py "input file" "output dir" "pack id"
# Compile *.lua to some mcfunction files
python compile.py "input file" "output dir" "pack id" # pack id is optionalRun in minecraft:
/function mclua:util/init_stroage
/function mclua:util/init_score
/function output:main # replace "output" with your pack id
/function mclua:util/remove_stroagea = "hello world!"
function hello( arg1__string )
aa = "func:" + arg1
print(aa)
return aa
end
hello(a)
c = 123 % 5
if c == 3 then
print("right!")
else
print("wrong!")
end
for i=0,3,1 do
j = str(i)
j = "Counter: " + j
print(j)
end
print("mclua demo end")