Posts: 90
Threads: 8
Joined: Dec 2011
Thanks: 0
Given 4 thank(s) in 4 post(s)
I had a little idea:
We could at least use a pair of functions:
e.g.: cEntity * cWorld::LockEntity(...)
and void *cWorld::ReleaseEntity(...)
Or do it via an easy, selfmade lock object, which only calls the worlds entity lock.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
Pair of functions - not good, someone will forget the lock locked somewhere and no-one will find it. With RAII, someone could still forget the locking completely.
The point of an API is to be safe whoever wants to call whatever. Windows API, too, doesn't say "you need to lock the filesystem, only then you can call the FileOpen function", it does the locking in itself, when needed. That's the point of the entire API - hide the locking from the "users". In this case "users" = other programmers using that API.
Pity that we don't have C++11 yet, we could use lambda functions as the callbacks, and you'd be happy. But trust me, this is the best possible way.
Posts: 1,450
Threads: 53
Joined: Feb 2011
Thanks: 15
Given 120 thank(s) in 91 post(s)
I removed cWebPlugin_Lua and cPlugin_NewLua now inherits cWebPlugin. This means a Lua plugin is a web plugin by default.
Plugin:CreateWebPlugin() is now deprecated/obsolete
Now plugins need to call Plugin:AddWebTab() to add a tab instead of WebPlugin:AddTab()
AddTab() is marked deprecated/obsolete