-
Notifications
You must be signed in to change notification settings - Fork 1
Objects
There are 4 main types of objects in the multi library
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:
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 runnerNote: 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
process:newTLoop(function(self)
print("Looping every second...")
end,1)main.lua
require("multi.all")
pro=multi:newProcess("testfile.lua")
pro:Start() -- starts the process
multi:mainloop() -- start the main runnerSo 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
require("multi.all")
multi:newTLoop(function(self)
print("Looping every second...")
end,1)
multi:mainloop() -- start the main runnerNow that we see how we can use Actors on a runner let's get into each Actor and how they work