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

Allow setting/getting global variables in Plugins #19

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

taminob
Copy link
Owner

@taminob taminob commented Nov 27, 2024

Add two functions for setting/getting global variables to each plugin type:

  • global<T>(variable_name) for getting global variables
  • global(variable_name, value) for setting global variables

@taminob taminob added enhancement New feature or request python Related to python plugin C Related to C plugin C++ Related to C++ plugin Lua Related to Lua plugin labels Nov 27, 2024
@taminob taminob self-assigned this Nov 27, 2024
Since this plugin is supposed to do nothing, the global function will
simply return a default constructed value for the getter and do nothing
for the setter.
This will return the second template parameter of a template class.
It will be used for retrieving the error of Expected when it is not
clear that the class actually has enough template parameters.
A default value can be passed in case the class does not have sufficient
template parameters.
Although the class is called CallError, it is also used for errors when
setting/getting variables.
Thus, the new error class incorrectType can help narrowing down the
actual issue when passing the wrong type for a variable. This can only
be detected in the scripting languages.
This alternative is called RemoveCvrefT.
Previously, this was performed in PythonTuple.
However, this is less flexible since an unnecessary PythonTuple needs to
be constructed that way which is why it was moved to PythonObject.
Previously, the returned string was interpreted as a null-terminated
C-string. However, a Python bytes object may contain null bytes in the
string which is why the separately stored string length must be used to
construct the correct string.
This feature will probably not be implemented and thus the placeholder
does no longer make sense.
@taminob taminob force-pushed the feature/set-global-in-plugin branch from 1c3aa07 to 703f04b Compare February 19, 2025 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related to C plugin C++ Related to C++ plugin enhancement New feature or request Lua Related to Lua plugin python Related to python plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant