Commit graph

6 commits

Author SHA1 Message Date
phosit
a40caaffc4 Support dynamic import
The static `import` should be prefered over the dynamic but it might be
usefull when loading an object from a json file.
2025-06-06 17:36:35 +02:00
phosit
252df0a1db Return the namespace of a module
To make it easy for the engine to access the exported values the
namespace is returned from the future.
2025-06-06 17:36:35 +02:00
phosit
d26d9b9b2b Rethrow exceptions from the top level of a module 2025-06-06 17:36:35 +02:00
phosit
ce01bdddf6 Allow to check whether modules finished evaluating 2025-06-06 17:36:35 +02:00
phosit
32ef4fd0fa Normalize module-path
Modules indipendant of the path, should only be evaluated once.
2025-06-06 17:36:35 +02:00
phosit
c6d42ebbd5 Support JavaScript modules
- With modules JavaScript code can be split up into multiple files. We
	already implemented such a mechanism (`Engine.LoadLibrary`) in
	multiple parts of the engine. The advantage of using modules is
	that it's standart (JS-devs are familiar with it) and it doesn't
	has to be implemented multiple times.
	Note that `Engine.LoadLibrary` loads all files in a directory
	while the new `import` only loads one file.

- With modules seemingly global variables are local to that
	script/module. We already implemented such a mechanism
	(`ScriptInterface::LoadScript`).
2025-06-06 17:36:35 +02:00