This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Node | |
| func pack(p:Node)->PackedScene: var v = PackedScene.new(); v.pack(p); return v | |
| class A extends Node: | |
| @export var m: String = "a" | |
| static func instantiate(p:PackedScene): | |
| var v: A = p.instantiate() | |
| v._post_init() | |
| return v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # how to simulate a class property that can be asigned only the first time, like a 'final' property in java or a 'readonly' property in C# | |
| #class_name ReadOnly | |
| extends Node | |
| # READONLY NON OBJECT WITH SPECIFIC TYPE | |
| var readonly_int:int: | |
| set(p): | |
| if readonly_int != 0:printerr('cannot set readonly property "readonly_int" a second time'); return | |
| readonly_int = p |
OlderNewer