From 73e7c565ac12c0e3f1ec68c5cd6e90973af2e4b3 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Sat, 2 Apr 2022 13:13:54 +0200 Subject: [PATCH] Updated Program (markdown) --- Program.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/Program.md b/Program.md index 6d3f665..4c83379 100644 --- a/Program.md +++ b/Program.md @@ -1 +1,46 @@ -WIP \ No newline at end of file +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: + +````lua +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](https://github.com/NoryiE/NyoUI/wiki/Object): + +## getStatus +Sets the displayed button text +````lua +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
+ +## execute +executes the given path (-program) +````lua +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:**-
+**returns:** the object
+ +## stop +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 +````lua +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