Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 20 Mar 2014 06:47 PM |
Hi, I haven't used ROBLOX in a while but I've been thinking of implementing RBXScriptSignal like events/event processing for my own game engine. I need to know if registered listeners should be implemented as functions that are to have threads for them created and called by these threads when an event fires, or if the event information should be forwarded to the thread that installed the listener (such as a thread specific queue) for further processing. Up until this point I've been planning for queues, but the other implementation I just described, that is RBXScriptSignal-like in my eyes based off the documentation, would work fine with my framework too.
Also, was the disconnect() method of events obsoleted because usage of RBXScriptConnection:disconnect() was able to disconnect a single listener specific to the connect() method that returned the object while event:disconnect() disconnected all listeners or a single listener indiscriminately? |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 20 Mar 2014 07:07 PM |
yeah
local touch = script.Parent.Touched
touch:connect()
wait(10)
touch:disconnect() |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 20 Mar 2014 07:11 PM |
@Lolb I wasn't looking for example code, I'm writing an API for my own game engine using C. I need information on how the listeners are executed.
1) Are listeners executed in their own thread? Are they simply co-routines? 2) Is execution of a listener blocked until a previous listener established by the same thread finishes executing? |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 20 Mar 2014 07:38 PM |
sorry tl;dr
i don't know much about what c can do but you should google it. there's tons of blogs who post even source code about their engines |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 20 Mar 2014 07:39 PM |
| Dude I'm not out to steal their source code. Also I don't care about their APIs, only ROBLOX's. |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 20 Mar 2014 07:41 PM |
I need you to understand right now that recreating an API from scratch != stealing source code. Also, it looks like the HopperBin's page on the ROBLOX wiki was totally obliterated. |
|
|
| Report Abuse |
|
|
Draeton
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4269 |
|
|
| 20 Mar 2014 08:29 PM |
| Alright, I'm going with executing listeners in their own threads immediately. |
|
|
| Report Abuse |
|
|
| |
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 20 Mar 2014 09:46 PM |
---------------------------------- --Here I made an oop system and a RBXScriptSignal like system too -- ^-^ ----------------------------
Class = {}
function Class.new(constructArgs) ----class = {} ----setmetatable(class, Class)
----class construct stuff goes here
----return class end
Class.eventName = {} Class.eventName.calls = {}
function Class.eventName.func(args) ----Class stuff ----for _, v in pairs(Class.Event.Calls) do --------v(args) ----end end
function Class.eventName:connect(func) ----table.insert(self.Calls, func) ----return #self.Calls end
function Class.eventName:disconnect(id) ----table.remove(self.Calls, id) end |
|
|
| Report Abuse |
|
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
| |
|