Controlling program flow from scripting languages is a tractable extension which lowers barriers for extending functionality in lower level languages (such as fortran).
In this presentation we show how a set of required features enables end-users to change and control the program flow using Lua scripts.
The following features are necessary for minimal code in the hosting program:
- dictionaries for seamless data exchange with little coding effort
The dictionaries allows (pointers to) data to be referenced via characters and ensures
no intermediate copying of data.
- running a Lua interpreter
- creating interaction points in program
This is the most problematic part since you have to expose break points where the
hosting program stops and calls Lua. Another approach would be to build your entire program
In our density functional theory program (Siesta) we expose Lua for users to implement their own molecular dynamics engines, change convergence criteria/properties based on self consistent cycles, and more.
This coding effort revealed substantial insight on how to control and expose data structures for end users in scripting languages.
We envision that other scripting languages are better suited since the communities are not experienced Lua coders/users, e.g. Python, nim.