Sorry, we don't support your browser.  Install a modern browser

Add native support for `require`.#837

Currently, several external editor plugins emulate require using https://github.com/Benjamin-Dobell/luabundle to emulate it in pure lua.

In my opinion, this has at least a couple of downsides:

  1. Since moonsharp is unware of the bundling, error messages don’t have line numbers that match up to the unbundled code.
  2. This requires support for luabundle to be included in any editor extension or other tool (i.e. https://github.com/tomprince/tabletop-tools) if they want to support `require.

My suggestion is to use https://www.moonsharp.org/scriptloaders.html to allow bundling modules with a save game. I’m not sure what the appropriate UI for this would be, but the savegame would have a top-level LuaModules dictionary, that mapped names available to require to the corresponding text of the module.

3 years ago