button = gui.createButotn( "Button", function() doSomething() end ) button:trigger()
GUI.API | Simple & Powerful Buttons,Dialogue Boxes, Text-boxes, and More!
#21
Posted 13 June 2014 - 01:05 AM
#22
Posted 13 June 2014 - 05:20 PM
Looking at the code I noticed that ret is not local, so everytime you call box:draw(), ret will have the value of the last dBox.
I didn't test it with y/n-boxes, but there will be the same problem. I solved it with declaring ret as local at the start of the draw-function, so it will be deleted after the function finished:
function Boxs:draw( x,y,width,color,bcolor,tcolor ) local ret = nil ... --all the other stuff here end
#23
Posted 13 June 2014 - 07:52 PM
#24
Posted 16 June 2014 - 03:44 AM
#25
Posted 19 June 2014 - 06:12 AM
#26
Posted 19 June 2014 - 09:11 AM
this is the code.... It crashes and turns red without even clicking the button as well....???
os.loadAPI("/api")
function hi()
print "Hi"
end
button = api.createButton ("button", fucntion() hi() end)
button:draw(1,1 5, colors.green, colors.white)
button:toggle(colors.red,4)
button:trigger()
It then gives me this error "api:70: attempt to index ? (a nil value)"
#27
Posted 19 June 2014 - 07:26 PM
Change:
os.loadAPI("/api")
To:
os.loadAPI("api")
#29
Posted 20 June 2014 - 10:51 PM
function() hi() end
You have written fucntion().
#30
Posted 30 June 2014 - 02:21 AM
#31
Posted 30 June 2014 - 09:17 AM
Just downloaded the API so latest version.
[string "gui"]:70: attempt to index a nil value after running the following code
os.loadAPI("gui")
button = gui.createButton( "button", function() print("Hello World!") end ) --#This creates a new button with a function that when triggered will print "Hello World!"
button:draw( 1,1, 5, colors.green, colors.white ) -- #This draws the button at (1,1) with a width of 5. The first color is what the buttons color will be and the second color is the text color
button:toggle( colors.red,4) --#This toggles the buttons color to red for 4 seconds (If you leave the second argument as nil it will just toggle the button)
button:trigger() --#This triggers the buttons function
gui.detect( 1,3,true ) --#this checks an array of all the buttons you've defined and returns the name of the button. If you also set the third argument to true it will trigger that buttons action
It errors on button:trigger()
Edited by gknova61, 30 June 2014 - 09:17 AM.
#32
Posted 08 August 2014 - 01:52 AM
I found no way to pull an event like "key_up" therefore you can just toggle shift at the moment. Maybe that will be implemented in a later version of CC...
I hope you update your API so all the people who want to work with that awesome API have that fix without having to manually paste it into their version.
#33
Posted 13 August 2014 - 10:13 AM
http://pastebin.com/NiQJJdUU
#34
Posted 19 August 2014 - 09:54 PM
#36
Posted 24 August 2014 - 02:29 AM
NikolaiM, on 13 August 2014 - 10:13 AM, said:
http://pastebin.com/NiQJJdUU
#37
Posted 25 August 2014 - 11:32 PM
TommieIV, on 19 August 2014 - 09:54 PM, said:
#38
Posted 27 August 2014 - 01:22 AM
#39
Posted 29 August 2014 - 03:52 PM
#40
Posted 04 September 2014 - 07:16 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











