// script
void changeMaterial(IEntity* e, UserData* ud)
{
Material& mat=e->getGraphicObject(0)->getMaterial(0);
// ...
}
the script compilation bails out when it comes to the assignment of the material.
I changed my code to return a pointer to a material and this works without any problem.
So I just want to make sure this is an unsupported feature :)
Cheers
Tom
🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Script var byref
hi
Is it correct that you can't define variables as references in a script function?
i'd like to do the following:
Yes, references are only supported in the function parameters. I may change this in the future though, at least for objects, as I want to remove pointers altogether.
Sorry, I need to reformulate that. I want to remove pointers as they do in fact complicate matters, but of course I can't do that until I've found a replacement that works equally well (which probably means never).
However I have recently found myself thinking of branching the project and making a separate library that doesn't even have pointers. It would then work more like Java where all objects are handled with references. The application would still be able to pass a pointer to the scripting engine of course.
These thoughts are still very immature though and it's nothing that's going to happen this year at least.
However I have recently found myself thinking of branching the project and making a separate library that doesn't even have pointers. It would then work more like Java where all objects are handled with references. The application would still be able to pass a pointer to the scripting engine of course.
These thoughts are still very immature though and it's nothing that's going to happen this year at least.
How about implicitly converting pointers to refferences and back? Internally, pointers and refferences are treated the same way. It's only when accessing members that there's a difference. (refferences are like regular variables, pointers use derefferencing). This would pretty much instantly remove the need for pointers
That would be a possibility. I need to look into it further to make sure that it is safe to do it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement