Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.3k views
in Technique[技术] by (71.8m points)

lua - How to make a multi-level return from a function?

how return more then 1 level of callers in lua?

something like in Forth when your drop 1 value from stack of returns?

    arrSimpleConv=
          (function(result,base)if not base then return  nil end
  for rec in (function(rst) if not rst then return pairs({}) end 
                       rst:Sort{{field=5,descent=true},{field=7},{field=10}}
                return rst.Records end)(base.RecordSet) do
    result[#result+1]= { 
                         Type = rec:GetValue(5),
                         LegName = rec:GetValue(10),
                         PickName = rec:GetValue(11),
                         FlagHierarch = tonumber(rec:GetValue(30)),
                         Rules = (function(result,input)
                                for i,p in ipairs(input) do
                                  result[i] = table.unserialize(p)
                                end return result end)({},rec:GetValue(20, 0))
                       }
  end return result end)(arrSimpleConv or {},CroApp.GetBank():GetVocabulary():GetBase("XX"))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...