Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

Commit 67034bb

Browse files
committed
22.2.2
1 parent 150461d commit 67034bb

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 22.2.2
2+
## Fixes
3+
- You can now edit the properties of special objects in scripts
4+
15
# 22.2.1
26
## Fixes
37
- Fixed the `Special object cannot be an enum constructor` error showing up even if the special object is not an enum constructor

haxelib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"script"
1010
],
1111
"description": "SScript (also known as SuperlativeScript), fork of HScript with fixes and improvements.",
12-
"version": "22.2.1",
12+
"version": "22.2.2",
1313
"classPath": "src/",
1414
"releasenote": "Check CHANGELOG.md",
1515
"contributors": [

src/hscriptBase/Interp.hx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ class Interp {
220220
}
221221

222222
function setVar( name : String, v : Dynamic ) {
223-
variables.set(name, v);
223+
if( specialObject != null && specialObject.obj != null && specialObjectsFields.contains( name ) )
224+
Reflect.setProperty(specialObject.obj, name, v);
225+
else
226+
variables.set(name, v);
224227
}
225228

226229
function assign( e1 : Expr, e2 : Expr ) : Dynamic {
@@ -234,8 +237,22 @@ class Interp {
234237
{
235238
if( finalVariables.exists(id) )
236239
return error(EInvalidFinal(id));
237-
238-
if(!variables.exists(id))
240+
241+
var i = 0;
242+
if( !variables.exists(id) )
243+
i++;
244+
if( specialObject != null ) {
245+
if ( specialObject.obj != null ) {
246+
if ( !specialObjectsFields.contains( id ) )
247+
i++;
248+
}
249+
else
250+
i++;
251+
}
252+
else
253+
i++;
254+
255+
if ( i == 2 )
239256
error(EUnknownVariable(id));
240257
setVar(id,v);
241258
}

0 commit comments

Comments
 (0)