Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

RFC: Adding Methods/Properties to RGP Lua that only exist in certain Finale versions #348

Open
rpatters1 opened this issue Aug 22, 2022 · 2 comments

Comments

@rpatters1
Copy link
Collaborator

I will soon be adding to RGP Lua some methods and properties that are not available before a certain Finale version. Previously when this has happened, the methods and properties appear in all Finale versions but return a default value in earlier Finale versions where they aren't supported. Until now there has always been an appropriate default value.

However, these new methods and properties I plan to add do not have useful default values in earlier Finale versions. In fact, it would be a bad idea to return anything at all unless running in an supported Finale version.

To me the best solution would appear to be not to hook up these methods and properties to Lua if the Finale version doesn't support them. But that means, in perpetuity, Lua programmers will have to check them for nil before calling them. Does anyone have other/better ideas?

@Nick-Mazuk
Copy link
Member

I don't, and that's what the client library is for: https://www.finalelua.com/docs/library/client

In reality, anytime in the future we use a feature only supported by new versions of RGP Lua (especially in the function library) we should be using client.supports. So I don't see a huge downside to this. Even if Finale did support it, we should be using client.supports because older versions of RGP Lua didn't support it.

@rpatters1
Copy link
Collaborator Author

Someone on the JW Lua list suggested throwing an error instead of omitting the functions. I like this idea, because it would work for C++ clients as well. I'm not sure if it will be possible. I will have to

  • Determine if I can throw a c++ exception back to Lua in a way that is both useful and graceful.
  • Get approval to introduce throw into the PDK Framework codebase.

This might force a better discipline around the usage of these properties. Either specify a minimum Finale version or use pcall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants