katsaii / catspeak-lang

A cross-platform modding language for GameMaker games.
https://www.katsaii.com/catspeak-lang/
MIT License
81 stars 4 forks source link

Fix 3.0.0 - Fixed issue with instances not being recognized as "structs" #75

Closed tabularelf closed 10 months ago

tabularelf commented 10 months ago

Seems like a sort of weird GM quirk territory. But applying an instance via .setSelf(instance_id) and then trying to do this in catspeak, results in an unexpected error.

Catspeak v3.0.0: runtime error in a file at (line 12, column 25) -- variable 'self' is not indexable, got 'struct'
 at gml_Script___catspeak_error (line 25) -     show_error(msg, false);

Catspeak code:

self.number = 10;
self.number += 10;
self.number /= 2;
self.number *= 4;
show_debug_message(self.number);

Narrowing it down has lead to me finding out that despite .setSelf(instance_id) passing in self, it treats it as an instance moreso. And therefore fails the is_struct check. The I've applied here allows all of this to work for instances.