YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
24 stars 8 forks source link

In-Game: Inconsistent conversion of array to string #6981

Open scott-dunbar opened 7 months ago

scott-dunbar commented 7 months ago

Description

GMRT will not convert arrays to strings in a consistent manner.

As shown in the below screenshots, GMRT will display the array differently in the output and what is rendered to screen. It will also remove quotes from strings within the array

Test package 0.4.2

VM image

GMRT image

arraystring.zip

Expected Change

No response

Steps To Reproduce

  1. Start GameMaker
  2. Import attached project
  3. Run project for VM and observe screen and output
  4. Run project for GMRT and observe screen and out

How reliably can you recreate this issue using your steps above?

None

Which version of GameMaker are you reporting this issue for?

No response

Which platform(s) are you seeing the problem on?

No response

Compiler Log File

Sample .yyz File

LukeBrownYoYoGames commented 6 months ago

Yeah this is an age old discussion about what to do here. Since GML objects and arrays are under the hood JS objects and arrays, they implement and call to JS toString function. I dont necessarily want to start splitting these two at that level, particularly since the llvmir generated code calls the constructor for these so the change would need to be at the call site

A potential workaround would be to change the gml "string" function to call json_stringify under the hood which would result in the same output as it previously did, but this would not change the output of obj.toString() which might be confusing

LukeBrownYoYoGames commented 6 months ago

I spoke with Francisco a bit about this and we're leaning towards telling people to just use show_debug_message / json_stringify in place of this. I will bring it up for further discussion

scott-dunbar commented 6 months ago

my only thought is the inconsistency is the confusing part.

show_debug_message(array) produces one result [ "0123", 456 ] and draw_text(x,y, array) produces another 0123, 456

DiasFranciscoA commented 6 months ago

We should probably need to make everything follow the JS standard then, so both show_debug_message and draw_text match on 0123, 456 and if a user wants to print the actual formatted output they'll need to json_stringify it.