Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ;
- abstract StringKey({}) from {} {
- @:extern @:arrayAccess public inline function arrayAccess(key:String):Dynamic {
- return Reflect.field(this, key);
- }
- @:extern @:arrayAccess public inline function arrayWrite<T>(key:String, value:T):T {
- Reflect.setField(this, key, value);
- return value;
- }
- }
- typedef Some = {
- sk: StringKey,
- }
- class Main {
- static function main() {
- var a:Some = {
- sk: {
- a: 4,
- b: 3
- }
- }
- trace(a);
- trace(a.sk["a"]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement