gitlab.com/Raven-IO/raven-delve@v1.22.4/_fixtures/linked_list.star (about)

     1  def command_linked_list(args):
     2  	"""Prints the contents of a linked list.
     3  	
     4  	linked_list <var_name> <next_field_name> <max_depth>
     5  
     6  Prints up to max_depth elements of the linked list variable 'var_name' using 'next_field_name' as the name of the link field.
     7  """
     8  	var_name, next_field_name, max_depth = args.split(" ")
     9  	max_depth = int(max_depth)
    10  	next_name = var_name
    11  	v = eval(None, var_name).Variable.Value
    12  	for i in range(0, max_depth):
    13  		print(str(i)+":",v)
    14  		if v[0] == None:
    15  			break
    16  		v = v[next_field_name]