Module:Sandbox/AnataBakka2

-- local p    = {} local lib  = require('Module:Feature')

function p.test(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end return expr(args[1]) end

function expr(val) if string.find(val,"[0-9]")==nil then return val end local s = "" local val=" " .. string.gsub(string.gsub(string.gsub(string.gsub(val," ",""),"([%/%*%+%-%^])"," %1 "),"%(","%( "),"%)"," %)") .. " "   local i=1 local j=1 local a,b,switcher,switcher2,switcher3,temp temp=val s = s .. " temp =" .. temp if string.find(val,"%)")~=nil then               switchertemp=mw.text.split( val, "%)") temp=last(switchertemp[1],"%(")           end            s =  s .. "  temp =" .. temp                a=mw.text.split( temp,"%-")                b=mw.text.split(a[2]," ")                s = s .. "  a[1] =x" .. a[1] .. "x"                s =s .. "  last =x" .. last( a[1]," ").."x"    return s end

function last(val,sign) local a=mw.text.split(val,sign) local j=1 while j>0 do       if a[j] ~=nil then j=j+1 else break end end return a[j-1] end

return p -- --