-
Notifications
You must be signed in to change notification settings - Fork 39
Program
This is one of my favorite part
With that object you are able to open programs like shell or worm or any custom program you've made. There is only 1 thing you have to make
sure: the program needs at least one os.sleep() or coroutine.yield() somewhere
One important note: this is currently in developement, if something doesn't work correctly feel free to tell me thx
Here is a example of how to create a default program:
local mainFrame = CreateFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):show()
This will create a default button with the size 12 width and 6 height on position 1 1 (relative to its parent frame), the default background is colors.black, the default text color is colors.white and the default zIndex is 5.
Here are all possible functions available for programs. Remember program inherit from object:
Sets the displayed button text
local mainFrame = CreateFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):show()
NyoUI.debug(aProgram:getStatus()) -- returns "running", "normal", "suspended" or "dead"
args:-
returns: "running" - if its running, "normal" - is active but not running (waiting for a event), "suspended" - is suspended or not started, "dead" - has finished or stopped with an error
executes the given path (-program)
local mainFrame = CreateFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):show()
aProgram:execute("rom/programs/fun/worm.lua") -- executes worm, have fuuuuuuuuuuuuuuun - only hard difficulty ok?
args: filepath - the path to the program you want to execute
returns: the object
gives a terminate event to the program, which means if you are running a shell, and the shell executes a program by itself you have to call stop 2 times to entirely close the running program
local mainFrame = CreateFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
mainFrame:addButton("myFirstButton"):setText("close"):onClick(function() aProgram:stop() end):show()
args:-
returns: the object
Thanks for checking out our wiki, join our discord for more help: discord.gg/yM7kndJdJJ