[DiscordArchive] did you consider using lua coroutines to force some things to run async (like db queries) while for
[DiscordArchive] did you consider using lua coroutines to force some things to run async (like db queries) while for
Archived author: Tea • Posted: 2024-02-15T16:11:37.991000+00:00
Original source
did you consider using lua coroutines to force some things to run async (like db queries) while for users they look like regular sync calls?
Archived author: jackpoz • Posted: 2024-02-15T16:17:06.453000+00:00
Original source
I'm wondering also if you push to the stack any unsafe pointer like Creature* or how you handle that
Archived author: Foe • Posted: 2024-02-15T16:35:06.942000+00:00
Original source
Yes, we implemented async db queries with callbacks, that was part of this big refactor
Archived author: Foe • Posted: 2024-02-15T16:35:43.436000+00:00
Original source
Creature is safe within the context of the map they belong to, once a unit is destroyed we remove their bindings before the object is deleted
Archived author: Foe • Posted: 2024-02-15T16:36:42.888000+00:00
Original source
On async queries though, we don't run coroutines, but we use the internal query processor
Archived author: Foe • Posted: 2024-02-15T16:37:34.765000+00:00
Original source
I'd much rather just have them be async and not abstract it away to look like synchronous calls, and end users just have to learn to use callbacks
Archived author: Tea • Posted: 2024-02-15T16:38:43.432000+00:00
Original source
what i mean is something like this (no callbacks)
```lua
local result = AuthDBQuery("SELECT bar FROM foo WHERE baz = 42069") -- actually a hidden coroutine
-- do stuff with result
```
Archived author: Tea • Posted: 2024-02-15T16:38:57.190000+00:00
Original source
without even allowing scripters to ever execute a sync query
Archived author: Foe • Posted: 2024-02-15T16:39:25.058000+00:00
Original source
Yeah I understand, I'm personally not a fan tbh, but it might be something to consider for the current synchronous queries in the future
Archived author: Tea • Posted: 2024-02-15T16:39:41.277000+00:00
Original source
the motivation here being forbidding synchronous queries more than anything else