Biting the bullet: exposing the JS window object to Lua

- Added a convenience function for creating HTML widgets, streamlining widget creation.
- Enhanced the key retrieval logic in the pairs function to ensure it captures prototype keys correctly.
- Exposed the global window object in the jsApi for better access to DOM functions.
This commit is contained in:
Zef Hemel
2025-03-31 15:51:02 +02:00
parent db62692d5a
commit bf8646d89d
5 changed files with 19 additions and 17 deletions
+2 -13
View File
@@ -69,17 +69,6 @@ export const jsApi = new LuaTable({
*/
stringify: new LuaBuiltinFunction((_sf, val) => JSON.stringify(val)),
// Exposing DOM functions
createElement: new LuaBuiltinFunction((_sf, tag) =>
document.createElement(tag)
),
createTextNode: new LuaBuiltinFunction((_sf, text) =>
document.createTextNode(text)
),
Blob: new LuaNativeJSFunction((
blobParts: any[],
options: BlobPropertyBag,
) => {
return new Blob(blobParts, options);
}),
// Expose the global window object
window: window,
});