finale-lua / lua-scripts

A central repository for all Lua scripts for Finale.
https://finalelua.com
Creative Commons Zero v1.0 Universal
15 stars 14 forks source link

Rewrite metadata parser in Lua #698

Closed asherber closed 7 months ago

asherber commented 7 months ago

Fixes #695

The main part of the action is still in JS. It sends the plugindef() function and a "parser" function to the Lua interpreter, which calls plugindef() and sends back a JSON version of its return values and the finaleplugin properties. Then we do some additional manipulation in JS and save the JSON.

My division of labor is basically that Lua is only invoked to interpret plugindef() and return the metadata; anything else (e.g., date formatting, forcing two decimal places on Min/MaxJWLuaVersion, etc.) is done back in JS.

I added some details about the process to the action's README, and I tried to make sure that the code is readable (and commented appropriately if something is unclear). I'm happy for suggestions if anything can be made clearer.

I confirmed through manual diffing that the output of the rewritten action matches the output of the current action. (Actually, there are a few differences -- places where the current action is buggy!)

asherber commented 7 months ago

(Because of the large-scale changes, I find it easier to digest the diff in Unified rather than Split format.)

rpatters1 commented 7 months ago

Look fantastic. The only suggestion I have is to prominently mention somewhere that the string conversion assumes 2 decimal places and that if there is ever a case where there are more or fewer, we will have to revisit this.

asherber commented 7 months ago

Thanks, I'll make that clearer.