Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I have been experimenting with using lilt in those places where I would normally write little bash or lua scripts to preform repeatable utility sorta tasks. 

Bash is convenient and portable, and bolted to my bones, but there are times when it gets unwieldy...I'm also sufficiently poisoned to function programing, so, find myself reaching for functionality that isn't there in bash (namely map, filter, etc). lil, through lilt is oh oh oh so close to being a suitable replacement for the little things I reach to do, but has edges that are just hairy enough I haven't made it a day-to-day choice, yet. 

(1 edit)

If you can recall any specific hairy edges, please share! Without user feedback, the only use-cases I've had to guide improvements are the things I've done myself, like using Lilt to re-slice images for gamedev projects, writing test fixtures, doing bulk image-import, and the occasional code-golf puzzle.

(1 edit) (+1)

Here is a sample file to demonstrate 2 issues I ran into last night.

The docs note that you don't need to seed random, but, every time I run random (at least on a given day, I haven't tried across days) I get the same result 

The other issue is with a for/else blocks not working as expected when testing passed args[] against known values, e.g. args[2] ~ "-l"

[edited to add that I'm using a version of lilt built form source the same day that Decker 1.7 was announced here on itch]

(+1)

Thank you for explaining your issues in more detail!

In Decker, the random seed is pre-initialized to a random value. In Lilt, it is consistently seeded out of the box. From the Lilt Documentation:

Choose y random elements from x. In Lilt, sys.seed is always pre-initialized to a constant.

The idea behind this is that Lilt behaves deterministically until you explicitly want randomness, which simplifies testing. This is also how random numbers have always worked in the K interpreter. I admit that this might be a footgun for the unwary, so I'll give changing the default some thought. For now, you can initialize the RNG with something like 

sys.seed:sys.ms

I gave your argument-parsing example a spin, and it works as expected for me. The "elseif" construct was introduced in Decker/Lilt version 1.16. In older versions of Lilt, "elseif" was not a keyword, so it would have just been a reference to an undefined variable with a value of 0, and then the predicate would similarly have been evaluated and then discarded. This explains why you're seeing the code behave as if the 'elseif args[2] ~ "-m"' line doesn't exist.

If you're using 1.7, please rebuild from source or download a fresh executable- there have been many improvements, bugfixes and additions in the last 9 releases. :)

(+1)

Thank you! This was super helpful. I'd totally misunderstood how the random seed was expected to work -- what you've described here makes a lot of sense to me, now, and with that things are working a-okay. 

Also, I'm feeling foolish to admit that I thought I was running 1.17, but was actually a few versions behind on lilt 🤦 that was totally my bad! 

Perhaps fewer hairy edges than I initially thought! In the end, the only hairy edge was me.