This project developed a Lua interface with UNO for LibreOffice, focusing on enhancing scripting capabilities by supporting complex method calls and exception handling. This integration enables Lua scripts to interact directly with LibreOffice components.
- Make it possible to use LibreOffice’s UNO API with LUA.
- Map the various UNO constructs to suitable LUA types.
- Lua-UNO Integration: Developed Lua bindings for UNO, allowing Lua scripts to interact with LibreOffice components.
- Exception Handling: Implemented comprehensive error handling for both Lua and UNO, ensuring stability.
- Support for Complex Operations: Added support for UNO methods, and in/out parameters in Lua scripts.
- Testing: Created test scripts, including one that opens a LibreOffice Writer document and writes "Hello World."
- Languages: Lua, C++.
- Tools: Gerrit, Git, Make, LibreOffice SDK.
- Methodologies: Test-Driven Development (TDD), Agile development.
- Development branch
- Key patchsets:
- Rough prototype of the LUA C++ binding
- Mapped C++ UNO objects to LUA and came up with a generic way to call UNO interface methods
- Implemented a generic struct by using the CoreReflection to get the XIdlClass and create the css.uno.Type from it
- Complete implementation of passing the in, out and in-out method arguments from LUA to UNO and vice-versa
- Exception handling
- Key patchsets:
- Final commit
- UNO framework: Navigating the code-base, understanding the interactions between UNO components, and the associated APIs required substantial effort.
- Mastering Lua Stack Indexing: Learning how to manage the Lua stack for efficient data handling between C/C++ and Lua.
- Exception Handling in Lua: Implementing robust error handling to catch and manage exceptions in Lua scripts.
- Setting Up a Test Environment: Creating a test setup for validating in, out, and in-out parameters in the Lua scripts.
- Understanding Invoke and Parameter Passing: Gained an understanding of the Invoke function and how to handle different types of parameter passing (in, out, in-out).
- LUA C API: Developed a thorough understanding of the Lua C API, including its functions and mechanisms for interacting with Lua from C/C++. This knowledge encompasses managing the Lua stack, interfacing with Lua objects, handling data exchange between C/C++ and Lua, and utilizing the API to extend Lua's functionality and integrate Lua scripts into C/C++ applications.
- Recursive Functions Implementation: Successfully implemented recursive functions in practice.
- Support for UNO Interface Attributes.
- Support for UNO objects implemented in Lua (so that they can be passed into LO for callbacks, like css.lang.Xcomponent::addEventListener).
- Better support in LUA for UNO enum values (than just using their raw integer values)
Working on this project has been challenging yet incredibly rewarding. It has not only sharpened my coding abilities but also allowed me to acquire new skills along the way. I'm deeply grateful to my mentor, Stephan Bergmann, for his constant guidance and support throughout this journey. A special thanks to Thorsten Behrens for co-mentoring, and to the LibreOffice community for being so helpful and welcoming to new contributors like myself.