Avoid recalculating operation names repeatedly. (#1)

Reviewed-on: pyrex/chameleonic#1
Co-authored-by: Kistaro Windrider <kistaro@gmail.com>
Co-committed-by: Kistaro Windrider <kistaro@gmail.com>
This commit is contained in:
Kistaro Windrider 2022-12-17 22:58:56 +00:00 committed by Pyrex
parent f7170428c9
commit 517c185688

View File

@ -12,11 +12,21 @@ function _update()
function _draw()
_doall("draw") end
mnames={}
function names(root)
local n=mnames[root]
if(n)return all(n)
n={root.."0", root, root.."2", root.."3"}
mnames[root]=n
return all(n)
end
function _doall(x)
for x2 in all(split"0,,2,3") do
for n in names(x) do
for mod in all(modules) do
local f=mod[x..x2]
if (f != nil) f(mod)
local f=mod[n]
if (f) f(mod)
end
end
end