Anonymous Login
2019-01-23 20:54 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002034OpenClonkEngine - C4Scriptpublic2018-04-22 14:25
ReporterMarky 
Assigned ToLuchs 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionno change required 
Product Version 
Target VersionFixed in Version 
Summary0002034: Feature Request: Allow function definitions in proplists outside of effects
DescriptionCalling getter and setter functions in proplists is better than accessing properties directly:
- one can rename the property internally, without breaking the access in other scripts
- if the getter/setter function is renamed the function call will fail, and that gets you a script error, so the error is detectable. Accessing a property by its name will either set an unused property, or simply return nil, which is hard to debug.

Currently this can be done by creating a definition with functions, e.g.

"MyPropertyDef" with the function "SetFoo(value){ this.foo = value; }", and then making a proplist "var my_proplist = new MyPropertyDef{};"

Being able to define functions in normal proplists (not just effects) is better, in my opinion.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0006186

Luchs (administrator)

I'm not sure what the request is about. Effect proplists aren't special in any way. You can put functions in any proplist, see for example AStar.c [1] or HotIce.ocs/Script.c [2].

[1]: https://github.com/openclonk/openclonk/blob/master/planet/System.ocg/AStar.c
[2]: https://github.com/openclonk/openclonk/blob/4ae0a92d39f07c493587358ae03679f8665ea891/planet/Arena.ocf/HotIce.ocs/Script.c#L166

~0006187

Marky (developer)

Ok, has to be constant then. I suggested creating a proplist with functions to Clonkonaut, so he created a new definition that implements this functions and used the definition as a prototype. Then I created this bug, because I thought it should be possible with normal proplists, too. Since it is, we can close the bug?
+Notes

-Issue History
Date Modified Username Field Change
2018-04-21 09:58 Marky New Issue
2018-04-21 10:07 Luchs Note Added: 0006186
2018-04-21 15:44 Marky Note Added: 0006187
2018-04-22 14:25 Luchs Assigned To => Luchs
2018-04-22 14:25 Luchs Status new => closed
2018-04-22 14:25 Luchs Resolution open => no change required
+Issue History