From 43a9488d38abb2ea6001afd8c6c36433bf44bc71 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 10 Jul 2008 20:29:29 +0000 Subject: Added finishingorder to displayform in viewfunctions to specify fields that go at the end. Fixed bug in getopts that ignored the last line if no trailing carriage return. git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1294 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lib/viewfunctions.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib/viewfunctions.lua') diff --git a/lib/viewfunctions.lua b/lib/viewfunctions.lua index dd2fcda..62a87c6 100644 --- a/lib/viewfunctions.lua +++ b/lib/viewfunctions.lua @@ -145,7 +145,7 @@ function displayformitem(myitem, name, viewtype) io.write("\n") end -function displayform(myform, order) +function displayform(myform, order, finishingorder) if not myform then return end if myform.descr then io.write('

' .. string.gsub(myform.descr, "\n", "
") .. "

\n") end if myform.errtxt then io.write('

' .. string.gsub(myform.errtxt, "\n", "
") .. "

\n") end @@ -161,12 +161,26 @@ function displayform(myform, order) end end end + local reversefinishingorder = {} + if finishingorder then + for x,name in ipairs(finishingorder) do + reversefinishingorder[name] = x + end + end for name,item in pairs(myform.value) do - if nil == reverseorder[name] then + if nil == reverseorder[name] and nil == reversefinishingorder[name] then item.name = name displayformitem(item) end end + if finishingorder then + for x,name in ipairs(finishingorder) do + if myform.value[name] then + myform.value[name].name = name + displayformitem(myform.value[name]) + end + end + end io.write('
\n') io.write('\n') io.write('') -- cgit v1.2.3