LDCad 1.7 Alpha 1 (win+linux)


RE: LDCad 1.7 Alpha 1 (win+linux)
#49
One question about scripting:

I got an idea lua scripts might help me with copying groups with their pivot point kept. And while looking around for LDCAD scripting examples, I found methods not mentioned on your Scripting API web page. Probably because lua in LDCAD evolved since the documentation was written. But what surprised me was that I could not get the list of methods by simple dump function. Are ldc objects somehow special? Or is the dump function too basic?
(I'm sorry I'm lua greenhorn, I just try to learn as I use it.)
 
Code:
local seen={}

function dump(t,i)
  seen[t]=true
  local s={}
  local n=0
  for k in pairs(t) do
    n=n+1 s[n]=k
  end
  table.sort(s)
  for k,v in pairs(s) do
    print(i,v)
    v=t[v]
    if type(v)=="table" and not seen[v] then
      dump(v,i.."\t")
    end
  end
end

function dumpLdc()
  dump(ldc,"")
end
--Register macros==============
function register()
  local macro=ldc.macro('Dump ldc')
  macro:setHint('Dump ldc')
  macro:setEvent('run','dumpLdc')
end

register()
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: LDCad 1.7 Alpha 1 (win+linux) - by Milan Vančura - 2021-08-12, 11:52

Forum Jump:


Users browsing this thread: 2 Guest(s)