-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add help() function to Lua "builtins." #798
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As a function parameter, an assignment expression or a `return` expression, `ll_convert()` can infer its target type. When it's important to specify the TOTYPE explicitly, rename the old `ll_convert()` function template to `ll_convert_to()`. Fix existing usage.
help() with no argument lists all our viewer builtins. help(function, function, ...) shows help text for each named function. Each argument can be either a string or the function in question (e.g. help(help)). To support Lua-related text containing line breaks, make LLTextEditor:: pasteTextWithLinebreaks() a public template method. Change the existing implementation, which specifically accepts (const LLWString&), into its LLWString specialization. The generic template passes llconvert(arg) to that specialization, the one real implementation. Make LLFloaterLUADebug methods call pasteTextWithLinebreaks() instead of insertText(), which ignores newline characters. To allow help() to accept an actual function as well as a string name, add a lookup-by-function-pointer map to LuaFunction. (A Lua function does not store a name.) Make the constructor store an entry in the new lookup map as well as in the original registry map. Change LuaFunction::getRegistry() and getRegistered() to getState() and getRState(), respectively. Each returns a std::pair, but the first binds non-const references while the second binds const references.
Partially addresses secondlife/viewer-private#189. |
maxim-productengine
approved these changes
Feb 13, 2024
leaphelp() (no argument) shows a list of all LEAP APIs. leaphelp(API) shows further help for a specific API. Both forms query LuaListener's LeapListener and report its responses. In future we might reimplement leaphelp() as a Lua function. Add LuaState::getListener() method, which checks whether there's a LuaListener associated with this LuaState and returns a pointer if so. Add LuaState::obtainListener() method, which finds or creates a LuaListener for this LuaState and returns its pointer. Both the above use logic migrated from the Lua listen_events() entry point, which now calls obtainListener() instead.
Maxim, I also added |
maxim-productengine
approved these changes
Feb 14, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
help()
with no argument lists all our viewer builtins.help(function, function, ...)
shows help text for each named function. Eachargument can be either a string or the function in question (e.g.
help(help)
).To support Lua-related text containing line breaks, make
LLTextEditor::pasteTextWithLinebreaks()
a public template method. Change the existing
implementation, which specifically accepts
(const LLWString&)
, into itsLLWString
specialization. The generic template passesllconvert(arg)
to thatspecialization, the one real implementation.
Make
LLFloaterLUADebug
methods callpasteTextWithLinebreaks()
instead ofinsertText()
, which ignores newline characters.To allow
help()
to accept an actual function as well as a string name, add alookup-by-function-pointer map to
LuaFunction
. (A Lua function does not storea name.) Make the constructor store an entry in the new lookup map as well as
in the original registry map.
Change
LuaFunction::getRegistry()
andgetRegistered()
togetState()
andgetRState()
, respectively. Each returns astd::pair
, but the first bindsnon-
const
references while the second bindsconst
references.