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

Editor plugin QOL enhancements #4105

Open
wants to merge 5 commits into
base: ui-redesign
Choose a base branch
from

Conversation

Emik03
Copy link
Member

@Emik03 Emik03 commented May 3, 2024

This PR adds a number of quality of life features and bug fixes:

  • The plugin reloading system is more aggressive, attempting multiple times instead of just once in case a file lock is held for a significant time. This should fix most issues regarding different programs writing to plugin.lua at once.

  • An additional check is placed to ensure that the reloaded string contains valid syntax, since it is possible for text to be partially written to, which previously caused a false error to show up, which confused some plugin developers.

  • Fix a bug where the name of the plugin wasn't shown when a runtime script error (not syntax error) occurred during initialization.

  • Several guards are added to ensure that exception spamming is less likely, while still keeping relevant information. One of these guards is that subsequent calls to draw that produce the same error message repeatedly do not get shown until it is called successfully once, or a different error message shows up, or the file gets reloaded.

image

  • Better feedback is given if the file gets renamed.

image

  • You get explicit feedback for a plugin being reloaded.

image

  • You can now log in various levels.

image

  • You can now eval, this is very useful for input boxes that would accept a formula. This is similar to the dynamic module, however the module is not used directly due to it leaking exceptions. The eval has the same amount of permissions as the script, except it is also unable to make function calls.

image

@ESV-Sweetplum
Copy link

Is the eval strictly a function body? If you can, please send the code for the eval example you have shown in the last image.

@Emik03
Copy link
Member Author

Emik03 commented May 5, 2024

I rewrote from memory without checking.

local x = 25 -- This is the value that gets referenced
local e = get("e", "")
_, newText = imgui.InputTextMultiline("text", e, 2000, {500, 500})

if newText ~= e then
    print(eval(newText))
end

state.SetValue("e", newText)

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

Successfully merging this pull request may close these issues.

None yet

2 participants