Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix text param val converting to number #1796

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

dstroud
Copy link
Contributor

@dstroud dstroud commented Sep 9, 2024

This PR addresses an issue that can cause "text" param values to be converted from strings to numbers when reading a pset file.

Note that the fix introduces the opposite behavior: if a text param was intentionally set with a number value, it will now be converted to a string upon pset read. That scenario seems like an edge case to me and is probably not how text params were intended to be used, but could still be seen as a breaking change.

Script to reproduce issue:

function init()
  -- init param with a string value that can be converted to a number
  params:add_text("text_1", "text_1", "1.1")
  print("param type at init: " .. type(params:string("text_1"))) -- string
  
  -- after saving and loading pset
  params.action_read = function()
    print("param type after pset read: " .. type(params:string("text_1"))) -- number
  end
end

- added check to prevent text param values from inadvertently being converted to numbers when reading pset file
@tehn tehn merged commit c6e5dfa into monome:main Sep 9, 2024
@dstroud dstroud deleted the fix-text-param-read branch September 9, 2024 18:34
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants