I am new at programming and only today for the first time I tried functions. So I have a problem.
I written a function risc(side1,color1,side2,color2,credit_value)
and after I run program I get error: "expected string, number" on line "if redstone.testBundledInput(side1,color1) then" which is in function.
For example: redstone.testBundledInput("front",colors.white) works good, but in that case functions don't help me very much and then I must write long code repeating everything.
Whats the problem?
THIS is program:
local sidel = "left" local sider = "right" local sidet = "top" local sidebo = "bottom" local sideba = "back" local sidef = "front" local whitec = colors.white local orangec = colors.orange local magentac = colors.magenta local lbluec = colors.lightBlue local yellowc = colors.yellow local limec = colors.lime local pinkc = colors.pink local grayc = colors.gray local lgrayc = colors.lightGray local cyanc = colors.cyan local purplec = colors.purple local bluec = colors.blue local brownc = colors.brown local greenc = colors.green local redc = colors.red local blackc = colors.black local credit = 0 local modem = peripheral.wrap("bottom") local m_bank_chs = 2 local m_bank_chr = 2 local function risc(side1,color1,side2,color2,credit_value) if redstone.testBundledInput(side1,color1) then credit = credit + credit_value modem.transmit(2,2,credit) peripheral.call("bottom","transmit",2,2, credit) redstone.setBundledOutput(side2,color2) credit = 0 modem.transmit(2,2,credit) peripheral.call("bottom","transmit",2,2, credit) end end while true do risc("left",colors.white,"right",colors.white,1000000000) risc("left",colors.orange,"right",colors.orange,500000000) risc("left",colors.magenta,"right",colors.magenta,100000000) risc("left",colors.lightBlue,"right",colors.lightBlue,50000000) risc("left",colors.yellow,"right",colors.yellow,10000000) risc("left",colors.lime,"right",colors.lime,5000000) risc("left",colors.pink,"right",colors.pink,1000000) risc("left",colors.gray,"right",colors.gray,500000) risc("left",colors.lightGray,"right",colors.lightGray,100000) risc("left",colors.cyan,"right",colors.cyan,50000) risc("left",colors.purple,"right",colors.purple,10000) risc("left",colors.blue,"right",colors.blue,5000) risc("left",colors.brown,"right",colors.brown,1000) risc("left",colors.green,"right",colors.green,500) risc("left",colors.red,"right",colors.red,200) risc("left",colors.black,"right",colors.black,100) risc(sideba,whitec,sidet,whitec,50) risc(sideba,orangec,sidet,orangec,25) risc(sideba,magentac,sidet,magentac,10) risc(sideba,bluec,sidet,bluec,5) risc(sideba,lbluec,sidet,lbluec,2) risc(sideba,yellowc,sidet,yellowc,1) risc(sideba,limec,sidet,limec,0.5) risc(sideba,pinkc,sidet,pinkc,0.25) risc(sideba,greyc,sidet,greyc,0.1) risc(sideba,lgreyc,sidet,lgreyc,0.05) risc(sideba,cyanc,sidet,cyanc,0.02) risc(sideba,puplec,sidet,purple,0.01) sleep(1) redstone.setBundledOutput(sider,0) redstone.setBundledOutput(sidet,0) end