1
我正在使用的程序被稱爲氧化劑,分形flam3編輯器。基本上要動畫這些美麗的數字藝術作品,我使用.lua
腳本。嘗試索引本地'g2'(函數值)
我正在使用的一個腳本,algorhythm.lua
調用其他腳本的功能。一個是控制腳本cs_temp.lua
另一個是utils.lua
。這是我得到錯誤的地方。
顯示爲錯誤的特定行是,下面的代碼中的第二行。
function alignx(g1,g2)
local x1,x2 = #g1.xforms,#g2.xforms
-- Align xforms for final-x, pad if necessary
local fx1,fx2 = 0,0
for x=1,x1 do
if g1.xforms[x].is_finalxform == "Y" then fx1 = x end
end
for x=1,x2 do
if g2.xforms[x].is_finalxform == "Y" then fx2 = x end
end
if fx1>0 or fx2>0 then
-- case 1: both have finalx - reorder g2
if fx1>0 and fx2>0 and fx1~=fx2 then
print('case 1')
if fx1>x2 then -- pad g2 with sufficient xforms
for i=1,math.abs(fx1-x2) do
table.insert(g2.xforms,newx())
print("adding xform to genome 2")
end
x2 = #g2.xforms
end
x2ind = agen(x2,1,x2)
x2ind[fx2] = fx1
x2ind[fx1] = fx2
xforms2 = ordx(g2.xforms,x2ind)
g2.xforms = xforms2
end
-- case 2: g1 has finalx but not g2 - xpad and reorder g2
if fx1>0 and fx2==0 then
print('case 2') -- pad g2 with final xform
local xtmp = newx(1)
xtmp.is_finalxform = 'Y'
xtmp.symmetry = 1
table.insert(g2.xforms,clone_genome(xtmp))
print("adding final xform to genome 2")
x2 = #g2.xforms
fx2 = x2
if fx1>x2 then -- pad g2 with sufficient xforms
for i=1,math.abs(fx1-x2) do
table.insert(g2.xforms,newx())
print("adding xform to genome 2")
end
x2 = #g2.xforms
end
x2ind = agen(x2,1,x2)
x2ind[fx2] = fx1
x2ind[fx1] = fx2
xforms2 = ordx(g2.xforms,x2ind)
g2.xforms = xforms2
end
-- case 3: g2 has finalx but not g1 - xpad g1 and reorder g2
if fx1==0 and fx2>0 then
print('case 3')
local xtmp = newx(1)
xtmp.is_finalxform = 'Y'
xtmp.symmetry = 1
table.insert(g1.xforms,clone_genome(xtmp))
print("adding final xform to genome 1")
x1 = #g1.xforms
fx1 = x1
if fx1>x2 then -- pad g2 with sufficient xforms
for i=1,math.abs(fx1-x2) do
table.insert(g2.xforms,newx())
print("adding xform to genome 2")
end
x2 = #g2.xforms
end
x2ind = agen(x2,1,x2)
x2ind[fx2] = fx1
x2ind[fx1] = fx2
xforms2 = ordx(g2.xforms,x2ind)
g2.xforms = xforms2
end
end
end
我知道這是很多篩選,但我想盡可能具體。
「我知道這是很多篩選,但我想盡可能具體」[卷是不精確。](http://www.catb.org/esr/faqs/smart-questions.html#volume ) – Mud
你將不得不追溯到最後調用alignx()的代碼。無論在你的情況下調用alignx(),都是將一個函數而不是一個表作爲第二個參數傳遞給alignx()。 –