Jul 3, 2023
The most common footgun I run into with Lua isn't the 1-indexing. It's the wildcard nature of '-'.

Today's head-scratcher:

> ('00-43'):match('^(%d%d)-(%d%d)')
00	43
> ('00-43'):match('^%d%d-(%d%d)')
nil

I should just always escape it ('%-') as a matter of course.

This post is part of my Freewheeling Apps Devlog.

Comments gratefully appreciated. Please send them to me by any method of your choice and I'll include them here.

archive
projects
writings
videos
subscribe
Mastodon
RSS (?)
twtxt (?)
Station (?)