OverviewFilesCommitsIssuesDocsReleasesPeers

codetree / test / fixtures / derive / sample.gd

27 lines · gd ref:
extends Node
class_name Sample

# The GDScript twin of sample.js. Same program, same control flow, so the two
# models must agree on ZONES, SHAPES, EXITS and CARRIED STATE. Node counts
# legitimately differ: JS has a template literal here, GDScript does not.

var total = 0

func tally(rows, limit):
	if rows == null:
		return null
	for row in rows:
		if row.skip:
			continue
		total = total + row.count
		if total > limit:
			break
	if total > 0:
		return total
	else:
		return 0

func label(row):
	var at = Time.get_ticks_msec()
	return str(row.name, at)