Hi all,
I'm trying to dig into T-Engine4 module development by hacking together stuff from various open source modules, but I also want to understand what the API's actually do. I think I'm building up intuition about most of the files but I am totally stumped by the resolvers.lua file and resolvers in general. Can someone help me understand what are resolvers and how they work?
Thanks!
Role of resolvers.lua in modules?
Moderator: Moderator
Re: Role of resolvers.lua in modules?
Resolvers basically are there to let you postpone some stuff in entities.
You *could* write a field like that in an entity:
But the call to rng.range would happen when the entity files is loaded and thus set the value in stone for all entities cloned from it.
If instead you used
Then it would take its value only when the entity has been cloned, making sure every clone has its own random value.
You *could* write a field like that in an entity:
Code: Select all
foo = rng.range(1,10)
If instead you used
Code: Select all
foo = resolvers.rngrange(1, 10)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning

-
- Posts: 2
- Joined: Wed Feb 17, 2016 6:32 am
Re: Role of resolvers.lua in modules?
Thanks! So a resolver is just a function you call as part of loading an entity right? Does the engine itself have any concept of resolvers?
Re: Role of resolvers.lua in modules?
Yes it does, a resolver function must return a table taht has a field "__resolver" set to a unique name (most of the time the same as the name of the resolver).
The engine will look for this name in the resolvers.calc table when it needs to actually resolve the entity.
Just take a look a the existing resolvers it should be self evident now
The engine will look for this name in the resolvers.calc table when it needs to actually resolve the entity.
Just take a look a the existing resolvers it should be self evident now

[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning
