0.4.0
Build & Release / build (push) Canceled after 0s

This commit is contained in:
4DBug committed 2026-10-16 22:53:18 -05:00
1 parent 1a83724317
commit 386b0c475e
46 files changed
+7897 -4414

No files matched your search

+19 -2
View File
@@ -113,15 +113,32 @@ def types_header(files):
lines += [" [string]: any,", "}"]
for name, keys in sorted(enums(files).items()):
lines.append("export type %s = { %s, [string]: number }" % (name, ", ".join("%s: number" % k for k in keys)))
return lines + module_type(set(enums(files)))
return lines + impl_type(files) + module_type(set(enums(files)))
def wrapper(files):
return "\n".join(["--!strict", "-- GENERATED by tools/gen_types.py - do not edit. The library is the child ModuleScript 'Impl'.", ""]
+ types_header(files) + ["", "return (require(script:WaitForChild(\"Impl\")) :: any) :: ImGuiModule", ""])
IMPL_SIGS = { # backend functions with exact types; the rest of ImGui_ImplRoblox is loose
"EnableParallel": "(opts: ImGuiParallelConfig?) -> ()",
"DisableParallel": "() -> ()", "FinishParallel": "() -> ()", "BeginParallelFrame": "() -> ()",
"GetParallelStats": "() -> { [string]: number }",
"GetParallelConfig": "() -> ImGuiParallelConfig",
}
def impl_type(files):
"""ImGui_ImplRoblox: the keys of the backend's public table (ImGui_ImplRoblox = { Name = ..., })"""
src = files.get("imgui_impl_roblox.lua", "")
m = re.search(r"^ImGui_ImplRoblox = \{\n(.*?)^\}", src, re.M | re.S)
keys = re.findall(r"^\s+(\w+)\s*=", m.group(1), re.M) if m else []
return (["export type ImGuiParallelConfig = { Actors: number?, MinTiles: number?, MinPixels: number?,"
" MaxBytesPerPixel: number?, Worker: any, Sync: boolean?, SyncDrop: boolean?, Inline: boolean?,"
" [string]: any }", "export type ImGuiImplRoblox = {"]
+ [" %s: %s," % (k, IMPL_SIGS.get(k, LOOSE)) for k in keys] + [" [string]: any,", "}"])
def module_type(enum_names):
# the bundle is too large for Luau to infer, so its return value is cast to this explicit type
lines = ["export type ImGuiModule = {", " ImGui: ImGuiAPI,"]
lines = ["export type ImGuiModule = {", " ImGui: ImGuiAPI,", " ImGui_ImplRoblox: ImGuiImplRoblox,"]
lines += [" %s: (x: number?, y: number?, z: number?, w: number?) -> %s," % (n, n) for n in ("ImVec2", "ImVec4")]
lines += [" %s: %s," % (n, n) for n in sorted(enum_names)]
return lines + [" [string]: any,", "}"]