View Single Post
Old 01-21-2022, 06:26 AM   #299
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,529
Karma: 8075938
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Okay, here's something semi-related to the last one:

Code:
program:
	if $#fanficcat && '/' in $#chapters then
		f = re($#chapters, '(.*)/.*', '\1');
		s = re($#chapters, '.*/(.*)', '\1');
		if s - f >=# 1 then s - f fi
	fi
Is there a less kludgey way to handle line 5 so that '0' returns an empty value (e.g. if fanfic_unreadchaps() then 'output' type things)
What I would do is:
Code:
program:
	res = '';
	if $#fanficcat && '/' in $#chapters then
		f = re($#chapters, '(.*)/.*', '\1');
		s = re($#chapters, '.*/(.*)', '\1');
		if s > f then
			res = s - f
		fi
	fi
You can get rid of 'res' if the result of the template is the value of the if
chaley is offline   Reply With Quote