-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
[lua] Add Global Variable details #5688
base: main
Are you sure you want to change the base?
Conversation
Looks ok. Might want to remove the extra blank lines added before the #endif though. |
Removed Lines. |
I'm somewhat doubting this now. min/max are loaded & saved without issue, which suits my purpose (a load/save lua script) However the numbers are the values stored presumably in memory, not the numbers the user sees on the screen, somewhat like what was happening in #4379 I'm looking back and following function calls through the handling of gvars on and end up with the following calls:
But that last function is somewhat of a monster and while I see it is largely that I feel either the implementation is fine, but the table values should be prefixed with "raw" or ask assistance on how to get the API values out as what the user sees on screen (which would be preferable). Sorry I hoped to do this by myself :-( |
'unit' and 'prec' are not boolean values, they are integers (even though they are currently limited to be either 0 or 1). |
So, I am happy with the first 1st, 2nd or 3rd commits. In the third commit I'm primarily looking at the user interface and noticing 2 things, as you say, I also noticed that, I'm working on an import/export script in lua and I don't really care, but am happy to go with either commit, or work with you or another team member to improve the API to be more obvious. Let me know what you want to do. Thanks |
'unit' and 'prec' are not treated as boolean in the UI - they select from a choice of values. If they were booleans they would be represented as toggle switches in the UI. The internal values for 'min' and 'max' are offsets from GVAR_MIN and GVAR_MAX respectively - this is so that the default (0) value stored map to the default minimum and maximum. The stored value range is 0 - 2048 in both cases. If you want to work with the -1024 - 1024 range in the Lua script then just apply GVAR_MIN and GVAR_MAX when getting and setting these values. int16_t vmin = GVAR_MIN + g_model.gvars[gvar].min;
int16_t vmax = GVAR_MAX - g_model.gvars[gvar].max; |
Changed with your recommendations, thanks :-) |
@philmoz is it right/correct for this to be requested to merge into main and how do we get that to happen? Thanks and Thanks for your help so far 🙂 |
Thanks and great. |
Fixes #5666
Add Lua API for getting details about Global Variables (not the value).
NOTE: I can and do code, but I really don't know C++, however I have put significant effort into getting this right. Thanks.