Hey!
#14
Ah so your single threaded. That makes things soooo much easier. Problem is that in mcserver's architecture you have to hold the players lock when using a player object. Otherwise the object can be removed right under you're code. So if we had an api like you're example:
Code:
p = Player("qaisjp")
// what happens if another thread deletes p here?
Kick(p, "Because I say so")
So you have to hold the lock whilst doing stuff with a player. Aquiring the lock is easy. The problem comes when we need to release it. There are two ways of doing this in lua. One is to __require__ that users call a function when they are finished with the player. This is a horrible interface because people forget. And the other way is callbacks. So the choice was callbacks or explicit lock releases. And we went for callbacks because then you can't get it wrong and crash the server.
Reply
Thanks given by:


Messages In This Thread
Hey! - by qaisjp - 06-11-2014, 07:50 AM
RE: Hey! - by worktycho - 06-11-2014, 08:35 AM
RE: Hey! - by FakeTruth - 06-11-2014, 02:00 PM
RE: Hey! - by xoft - 06-11-2014, 05:45 PM
RE: Hey! - by qaisjp - 06-12-2014, 05:29 AM
RE: Hey! - by xoft - 06-12-2014, 06:31 AM
RE: Hey! - by qaisjp - 06-13-2014, 12:53 AM
RE: Hey! - by FakeTruth - 06-12-2014, 08:17 PM
RE: Hey! - by bearbin - 06-13-2014, 01:00 AM
RE: Hey! - by FakeTruth - 06-13-2014, 01:28 AM
RE: Hey! - by bearbin - 06-13-2014, 01:48 AM
RE: Hey! - by worktycho - 06-13-2014, 01:56 AM
RE: Hey! - by qaisjp - 06-13-2014, 03:03 AM
RE: Hey! - by worktycho - 06-13-2014, 03:29 AM
RE: Hey! - by qaisjp - 06-13-2014, 04:32 AM
RE: Hey! - by worktycho - 06-13-2014, 04:41 AM
RE: Hey! - by qaisjp - 06-13-2014, 04:49 AM
RE: Hey! - by worktycho - 06-13-2014, 05:07 AM
RE: Hey! - by qaisjp - 06-13-2014, 06:07 AM



Users browsing this thread: 5 Guest(s)