Posted 16 August 2015 - 01:36 PM
Hello, i have a program that should call a function from a custom API but it displays just Attempt to index ? (a nil value) when it gets to that point. Weird thing is that my other APIs work perfectly fine. I also tried to call another function from that API but no functions from it work
code:
bpmaker
bpmakerbp
code:
bpmaker
os.loadAPI("bpmakerbp")
os.loadAPI("gui")
function triggerButton(id)
os.shutdown()
end
function button1_click()
os.shutdown()
end
term.clear()
bpmakerbp.implement() --error here
bpmakerbp
os.loadAPI("gui")
os.loadAPI("bpmaker")
local lastx = 0
local lasty = 0
local e,s
local clicked = false
local run = true
local buttons = {{1,1,10,1,"Add button",'button1_click'} }
function getClicks()
e,s,lastx,lasty = os.pullEvent("mouse_click")
clicked = true
end
function draw()
--addbutton
for i=1, #buttons do
gui.drawBox(buttons[i][1],buttons[i][2],buttons[i][3],buttons[i][4],buttons[i][5])
if clicked then
if gui.intersect(buttons[i], {lastx, lasty}) then
bpmaker.triggerButton(buttons[i][6])
end
clicked = false
end
--end
end
end
function implement()
while true do
parallel.waitForAll(getClicks, draw)
end