What types of variables can Luau scripts create using qsv luau
?
#587
-
Can
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
@derekmahar , your question inspired me to expand the Lua functionality of qsv:
With these changes, going to your questions:
To see an example of these extended capabilities, check out this test: |
Beta Was this translation helpful? Give feedback.
-
@derekmahar , I'm glad you liked it! TBH, I got tired of fighting python's distribution and GIL limitations with the I'm humbled by the "AWK for CSV" comparison. As for creating an AWK-like tool using Lua/Luau, I have enough on my plate with qsv and my CKAN-related projects 😄 - but I'm always open to new idears to make data-wrangling/data management better. And it took me about a day to pull together the --prologue and --epilogue functionality. Actually, switching to As I was troubleshooting the test, I found out about luau's += operator and if-then-else expression, and decided to switch after learning more about luau. Switching from Lua to Luau was not that big an effort thanks in large part to the wonderful mlua crate. |
Beta Was this translation helpful? Give feedback.
@derekmahar , your question inspired me to expand the Lua functionality of qsv:
--prologue
and--epilogue
options. The prologue allows you to run a Luau/LuaJIT script before the CSV is processed, typically for initializing variables. The epilogue is ran after the CSV is processed, typically for doing complex aggregations._idx
and_rowcount
._idx
contains the current row number while processing the CSV._rowcount
is set to zero while the CSV is being processed, and to the row count during the e…