Skip to content

[GS] expression command could give better return values #620

Closed

Description

@lesquoyb

Describe the bug
Currently the expression command always return a string value, but the json format used could support int, float, bool and complex values (dictionaries).

To Reproduce
Steps to reproduce the behavior:

  1. Run any gama model
  2. in a client ask for the color value of the simulation
  3. See something like 'color[transparent]'

Expected behavior
int, float and bool values could be unpacked and do not need to be wrapped into a string, complex objects could be serialized into json objects. For example a color would be something like this:

{
'gaml_type': 'rgb', 
'red': 255, 
'green': 0, 
'blue': 0, 
'alpha': 255
}

Activity

  1. lesquoyb commented on May 8, 2025

    @lesquoyb
    ContributorAuthor

    Actually I've noticed that the expression command had a hidden escaped parameter that is meant to do exactly that, the problem is that it doesn't work for rgb for some reason.
    So this raises three different problems:

    1. fix the json parse of rgb used in GamaServerMessage
    2. document the escaped parameter that was written nowhere except in the code
    3. add this parameter to the client functions
  2. lesquoyb commented on May 9, 2025

    @lesquoyb
    ContributorAuthor

    Finally I've directly added a json parse of the the return value automatically and removed the escaped parameter. It is now fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    About GAMA ServerThis issue concerns GAMA server usageEnhancementThis is a request for enhancement

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions