LÖVE port: love/ (generated by tools/love.sh), marked linguist-generated; submodule URLs -> GitHub
This commit is contained in:
1 parent
3723e1302a
commit
270bc84317
4 files changed
+3007
-1
No files matched your search
@@ -1,2 +1,3 @@
|
||||
.gitattributes export-ignore
|
||||
tools/upstream/** linguist-vendored=true
|
||||
love/** linguist-generated=true
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
[submodule "tools/core"]
|
||||
path = tools/core
|
||||
url = https://git.bug.tools/bug/imgui-luau.git
|
||||
url = https://github.com/4DBug/imgui-luau.git
|
||||
Generated
+2976
File diff suppressed because it is too large.
Load diff
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env sh
|
||||
# Regenerates love/: Lua 5.1 (LÖVE/LuaJIT) copies of the Luau sources. Needs darklua + python3.
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p love
|
||||
CFG=$(mktemp)
|
||||
echo '{ "generator": "retain_lines", "rules": ["remove_types", "remove_compound_assignment", "remove_if_expression", "remove_continue", "remove_interpolated_string", "remove_floor_division"] }' > "$CFG"
|
||||
for f in ImGuizmo.lua; do
|
||||
out="love/$(basename "$f")"
|
||||
darklua process -c "$CFG" "$f" "$out"
|
||||
python3 - "$out" <<'PY'
|
||||
import re, sys
|
||||
p = sys.argv[1]; src = open(p).read()
|
||||
src = re.sub(r"^\s*@native\s*$", "", src, flags=re.M)
|
||||
# Luau generalized iteration: for k, v in t do -> for k, v in __iter(t) do
|
||||
src = re.sub(r"^([ \t]*for[ \t]+[\w][\w, \t]*[ \t]in[ \t]+)([^\n]*?)([ \t]+do\b)", r"\1__iter(\2)\3", src, flags=re.M)
|
||||
head = ("-- GENERATED by tools/love.sh from the Luau source - do not edit\n"
|
||||
"local function __iter(t, ...) if type(t) ~= 'table' or (getmetatable(t) and getmetatable(t).__call) then return t, ... end "
|
||||
"local n, i, k = #t, 0, nil return function() if i < n then i = i + 1 return i, t[i] end "
|
||||
"repeat k = next(t, k) until k == nil or type(k) ~= 'number' or k < 1 or k > n or k % 1 ~= 0 if k ~= nil then return k, t[k] end end end "
|
||||
"table.create = table.create or function(n, v) local t = {} if v ~= nil then for i = 1, n do t[i] = v end end return t end "
|
||||
"table.clone = table.clone or function(t) local c = {} for k, v in pairs(t) do c[k] = v end return setmetatable(c, getmetatable(t)) end "
|
||||
"math.clamp = math.clamp or function(x, a, b) return math.max(a, math.min(b, x)) end "
|
||||
"math.sign = math.sign or function(x) return x > 0 and 1 or (x < 0 and -1 or 0) end "
|
||||
"math.round = math.round or function(x) return x >= 0 and math.floor(x + 0.5) or math.ceil(x - 0.5) end\n")
|
||||
open(p, "w").write(head + src)
|
||||
PY
|
||||
done
|
||||
rm -f "$CFG"
|
||||
Reference in new issue
Block a user