Updated Program (markdown)
47
Program.md
47
Program.md
@@ -1 +1,46 @@
|
|||||||
WIP
|
This is one of my favorite part<br>
|
||||||
|
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
|
||||||
|
<br><br>
|
||||||
|
One important note: this is currently in developement, if something doesn't work correctly feel free to tell me thx<br>
|
||||||
|
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:**-<br>
|
||||||
|
**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<br>
|
||||||
|
|
||||||
|
## 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:**-<br>
|
||||||
|
**returns:** the object<br>
|
||||||
|
|
||||||
|
## 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:**-<br>
|
||||||
|
**returns:** the object<br>
|
||||||
|
|||||||
Reference in New Issue
Block a user