Updated Objects (markdown)

2017-06-14 15:26:30 -04:00
parent 5ed629e4d0
commit 4747aebe5e
+44 -13
@@ -1,25 +1,56 @@
# Objects # Objects
There are 4 main types of objects in the multi library There are 4 main types of objects in the multi library
1. [Runners](https://github.com/rayaman/multi/wiki/Objects#Runners) 1. [Runners](https://github.com/rayaman/multi/wiki/Objects#runners)
2. [Actors](https://github.com/rayaman/multi/wiki/Objects#Actors) 2. [Actors](https://github.com/rayaman/multi/wiki/Objects#actors)
3. [Semi-Actors](https://github.com/rayaman/multi/wiki/Objects#Semi-Actors) 3. [Semi-Actors](https://github.com/rayaman/multi/wiki/Objects#semi-actors)
4. [Non-Actors](https://github.com/rayaman/multi/wiki/Objects#Non-Actors) 4. [Non-Actors](https://github.com/rayaman/multi/wiki/Objects#non-actors)
# Runners # Runners
As of right now there are only 2 Runners.
* Processors
* Queues (WIP) Note: I will document this when I get it working properly.
Processors inherit all of their methods from the multi namespace, while also adding a few methods of their own. A process acts exactly like the multi namespace as well. It does differ in some ways though. With the multi namespace you are not able to "pause" the main runner. Note: There are ways to do so, but it is important to know what you are doing first. Which you will when you are done reading this wiki 😄.
All processors are able to have Actors constructed and created on them. For example:
```lua
require("multi.all")
process=multi:newProcess() -- this can also load a file, to keep things really organized, I will show a simple example first then show the same thing being done within another file.
process:newTLoop(function(self)
print("Looping every second...")
end,1)
process:Start() -- starts the process
multi:mainloop() -- start the main runner
```
Note: I will not be giving the output to all examples on the wiki
As mentioned above you can load a process from file. This can only work if your lua environment allows for the usage of loadstring!
testfile.lua
```lua
process:newTLoop(function(self)
print("Looping every second...")
end,1)
```
main.lua
```lua
require("multi.all")
pro=multi:newProcess("testfile.lua")
pro:Start() -- starts the process
multi:mainloop() -- start the main runner
```
So as seen above Actors can be created on a process, however the objects we created were not on the main process. To create one on the main process we can do the same as above with just a slight change
```lua
require("multi.all")
multi:newTLoop(function(self)
print("Looping every second...")
end,1)
multi:mainloop() -- start the main runner
```
Now that we see how we can use Actors on a runner let's get into each Actor and how they work
# Actors # Actors
*
# Semi-Actors # Semi-Actors