1

私が使用しているプログラムは、フラクタル flam3エディターであるOxidizerと呼ばれます。基本的に、これらの美しいデジタル アート作品をアニメーション化するために、スクリプトを使用しています。.lua

私が使用しているスクリプトは、algorhythm.lua他のスクリプトを呼び出して機能させます。1 つは制御スクリプトで、cs_temp.luaもう 1 つは ですutils.lua。エラーが発生する場所です。

エラーとして表示される特定の行は1399で、次のコードの 2 行目です。

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

ふるいにかけることがたくさんあることはわかっていますが、できるだけ具体的にしたかったのです。

4

1 に答える 1

3

あなたの質問(まだ不明)によると、次の行に問題があります。

local x1,x2 = #g1.xforms,#g2.xforms

テーブルとして初期化する必要があるため、エラーAttempt to indexがLuaプログラムで発生します。g2.xformsg2

g2プログラムがテーブルではなく関数変数として解釈しているため、コード全体を確認し、関数として定義した場所をトレースします。

于 2013-01-16T01:23:05.687 に答える