Open samdeane opened 3 years ago
This could also be done with an asynchronous API, if it helped with managing back-end database access.
Eg: withElementById(uid, callback)
, where callback is a Lua function to call and pass the element object to.
Deckard basically answered it here for me... sort of. Your's is a little different approach.
That's a great post, thanks. I attempted to get us doing something similar last year, but it didn't really get much traction!
I am pleased to hear that Deckard says they have plans in that direction, though I'm worried that (a) I might not still be playing by the time they come to fruition, and (b) the game might not make it that far.
Hi there !
I can confirm you that, that kind of change is planed and in progress. We're thinking about which approach could be the best on that. However it will come anyway on linked elements too, to get data like getName for the example.
(originally posted here)
It seems fairly crazy that we can iterate the core to get basic information about the id, type, etc of each element (using
getElementIdList()
,getElementNameById
, ...), but we can't get the actual element objects that way. We have to link them, then access the named variables connected with each link. If we want to iterate all linked elements, we have to build our own table and write manual code to add the elements to it. That doesn't make a lot of sense!I would suggest deprecating most of the existing API, and just having two element related methods:
All other properties can then be read from the existing element API:
A few element API additions would be good: