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

Misc cleanup, fixes, and Lua function library improvements #5773

Merged
merged 12 commits into from
Feb 23, 2024

Conversation

sturnclaw
Copy link
Member

@sturnclaw sturnclaw commented Feb 21, 2024

This PR is a bit of a catch-all arising from development of #5734 and contains most of the feature-agnostic commits from that branch.

In no particular order:

  • Improved the Lua runtime library with several new utilities for operating on tables
  • Added a new utils.proto helper function for working with a prototype-based object model
  • Fixed an error when attempting to interpolate a non-string object into a string
  • Fixed a long-running bug with utils.print_r which caused it to print incorrect information about recursive tables (tables that have already been printed)
  • Fixed default forwarding constructor for utils.inherits - you can now receive arguments from the default .New() constructor of a subclass.
  • Fixed Hyperspace text color is unintentional #5765
  • Made most PiGui methods available to Lua autocomplete through the ui object. Documenting forwarded methods from C++ is still a WIP and will be improved over time.
  • Added two new utility UI functions - ui.getItemRect() and ui.Format.Volume
  • Improved the resilience of the tab views against erroring code
  • Some misc. preparatory changes for EquipSet v2.

- Add simple implementation of Self/Io-style prototypes
- Prototypes operate on a zero-copy delegation model where a new clone is an almost-empty instance
- Add table.merge to shallow copy values from one table to another
- Add table.append to concatenate an array to another
- Add utils.to_array to transform the values of a table into an array
- Avoids runtime errors when interpolating non-string values
- class.New propagates all its arguments to the base class New function
- class.Constructor forwards to the parent constructor if it exists
- Simplifies API of querying screenspace position of previously submitted elements, e.g. ui.dummy
- Add type information for Color objects
- Define the pigui 'ui' interface as a class so all assigned functions are available for autocomplete
- Fix incorrect parameters in LuaRand type information
Previously, an error in an individual tab's refresh() function would go uncaught and prevent the entire TabView from functioning until the game was restarted.
Commodity market reuses almost no code from the equipment market, so it makes little sense to depend on it.
@impaktor
Copy link
Member

Is onChangeEquipment incompatible with the future equip-v2?

@sturnclaw
Copy link
Member Author

onChangeEquipment was a legacy C++ signal for dispatching to C++ code that no longer exists (I'm guessing probably in the sector map / hyperjump planner when that was still C++). It's totally unused in current master, and will continue to be unused with the EquipSet v2 rewrite.

@sturnclaw sturnclaw merged commit f3c3aa9 into pioneerspacesim:master Feb 23, 2024
5 checks passed
@sturnclaw sturnclaw deleted the lua-utils branch April 27, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hyperspace text color is unintentional
2 participants