GUI API doesent work
#1
Posted 24 June 2016 - 01:16 PM
#2
Posted 24 June 2016 - 03:04 PM
#3
Posted 24 June 2016 - 03:22 PM
The_Cat, on 24 June 2016 - 03:04 PM, said:
#4
Posted 24 June 2016 - 03:52 PM
Edited by The_Cat, 24 June 2016 - 04:14 PM.
#5
Posted 25 June 2016 - 01:17 AM
getfenv()[srollrun[y][mouse]](scrollarg[y][mouse])--(scrollarg[y][mouse])
... because you haven't defined a "srollrun".
This line a little higher up isn't relevant to your immediate problem, but also needs correction:
getfenv()[scrollrun[mouse][y+1]](scrollarg[mouse][y+1])
... as you've got the table indexes the wrong way around.
If you're still having problems, explain what the script DOES do.
#6
Posted 25 June 2016 - 11:40 AM
Bomb Bloke, on 25 June 2016 - 01:17 AM, said:
getfenv()[srollrun[y][mouse]](scrollarg[y][mouse])--(scrollarg[y][mouse])
... because you haven't defined a "srollrun".
This line a little higher up isn't relevant to your immediate problem, but also needs correction:
getfenv()[scrollrun[mouse][y+1]](scrollarg[mouse][y+1])
... as you've got the table indexes the wrong way around.
If you're still having problems, explain what the script DOES do.
thankyou
But i have a new question:
If there any better way to use function in tje runing program as to code a function in the api who just runs os.loadAPI?
--Exampele --Best way to call the func test function test() print("test") end os.loadAPI("/lib/gui") gui.createScroll("Hello") gui.addScrollFunc("test","hello",1) gui.createScroll("world") gui.addScrollFunc("print","world",1) gui.drawScroll()
#7
Posted 25 June 2016 - 12:13 PM
--Exampele --Best way to call the func test function test() print("test") end os.loadAPI("/lib/gui") gui.createScroll("Hello") gui.addScrollFunc(test,"hello",1) --#this passes the actual function, rather than a string, as an argument. gui.createScroll("world") gui.addScrollFunc("print","world",1) gui.drawScroll()
#8
Posted 25 June 2016 - 12:44 PM
KingofGamesYami, on 25 June 2016 - 12:13 PM, said:
--Exampele --Best way to call the func test function test() print("test") end os.loadAPI("/lib/gui") gui.createScroll("Hello") gui.addScrollFunc(test,"hello",1) --#this passes the actual function, rather than a string, as an argument. gui.createScroll("world") gui.addScrollFunc("print","world",1) gui.drawScroll()
This doesent works
#9
Posted 25 June 2016 - 12:58 PM
Wilma456, on 25 June 2016 - 12:44 PM, said:
KingofGamesYami, on 25 June 2016 - 12:13 PM, said:
--Exampele --Best way to call the func test function test() print("test") end os.loadAPI("/lib/gui") gui.createScroll("Hello") gui.addScrollFunc(test,"hello",1) --#this passes the actual function, rather than a string, as an argument. gui.createScroll("world") gui.addScrollFunc("print","world",1) gui.drawScroll()
How are you using the argument (function)?
#10
Posted 25 June 2016 - 01:06 PM
MKlegoman357, on 25 June 2016 - 12:58 PM, said:
Wilma456, on 25 June 2016 - 12:44 PM, said:
KingofGamesYami, on 25 June 2016 - 12:13 PM, said:
--Exampele --Best way to call the func test function test() print("test") end os.loadAPI("/lib/gui") gui.createScroll("Hello") gui.addScrollFunc(test,"hello",1) --#this passes the actual function, rather than a string, as an argument. gui.createScroll("world") gui.addScrollFunc("print","world",1) gui.drawScroll()
How are you using the argument (function)?
in this function, the argument are not used, Its only there, because I had no errors.
#11
Posted 25 June 2016 - 01:43 PM
Wilma456, on 25 June 2016 - 01:06 PM, said:
I'm talking about the 'gui.addScrollFunc()' function. What is it doing? How is it using the function 'test'? You can treat functions just like any other variable. For example:
local function hello ( name ) print( "Hello, " .. name .. "!" ) end local function foo ( fn ) fn( "World" ) end foo( hello ) --> Hello, World!
Edited by MKlegoman357, 25 June 2016 - 01:43 PM.
#12
Posted 25 June 2016 - 03:58 PM
MKlegoman357, on 25 June 2016 - 01:43 PM, said:
Wilma456, on 25 June 2016 - 01:06 PM, said:
I'm talking about the 'gui.addScrollFunc()' function. What is it doing? How is it using the function 'test'? You can treat functions just like any other variable. For example:
local function hello ( name ) print( "Hello, " .. name .. "!" ) end local function foo ( fn ) fn( "World" ) end foo( hello ) --> Hello, World!
After you add a text with with gui.createScroll() You can add a funcktion to this text. For example:
gui.craeteScroll("text") gui.addScrollFunc("print","hello world",1)if you run this code, you get the text "text". If you clickk on the text "text" it runs print("hello world").
#13
Posted 25 June 2016 - 04:36 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users