-
Notifications
You must be signed in to change notification settings - Fork 151
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
Plugins in Main Menu #6386
base: master
Are you sure you want to change the base?
Plugins in Main Menu #6386
Conversation
Assigned to Nordfriese |
Mirrored from Codeberg
Shouldn't this get its own log type? ( Actually I think this would normally be better separated into its own PR if we were in the middle of a release cycle, and could merge it quickly. (sigh... I liked how lua output stood out... :) but of course I understand that this is the right thing to do) |
Mirrored from Codeberg Real |
Mirrored from Codeberg
The messages can be assembled in lua, so the lua log functions would only accept a single string. (pass it on as |
Mirrored from Codeberg Re last commit: Could you please make it like lua does it, and log a single line with all arguments to Also lua reports the object type too, not just the pointer address, which is often very useful... edit: and I believe |
Mirrored from Codeberg Thank you very much! :) Printing code now looks good, but not tested yet. |
Mirrored from Codeberg
Created on Thu Feb 29 11:49:44 CET 2024 by Benedikt Straub (Nordfriese)
Type of change
New feature for v1.3
Issue(s) closed
Plugins can now also be used in the main menu.
How it works
Example add-on
The main class for the main menu is called
wl.ui.MainMenu
. It offers all the usual Lua UI functions (includingcreate_child()
andget_child()
and all others), and support for timers.Plugin scripts are run in the main menu automatically like in the game and editor. Check for the existence of the classes
wl.ui.MainMenu
orwl.ui.MapView
to determine whether you're in the menu or game/editor. All game modules such aswl.Game
,wl.Editor
, andwl.Descriptions
are not available (nil
) in the main menu.When you modify enabled or installed plugin add-ons in the add-ons manager, the Lua interface is reset and all plugins reloaded. It is not however possible to keep track of modifications made by scripts; therefore, it is up to the script to check that it does not repeat interface modifications from earlier runs (see the example add-on's init.lua to see what I mean).
As a bonus, Lua's built-in
print()
now redirects to our ownlog_dbg()
for better Lua debug logging.Possible regressions
Screenshots