Page 1 of 1

[18.22] serpent.block reference

Posted: Sat May 09, 2020 10:40 pm
by doktorstick
Howdy. `serpent.block` isn't printing out information if the reference is shared among multiple keys nor is it indicating the value is a reference.

Take for instance the snippet below. If you examine the `.pictures` key in the large dump, only the first entry has the `tint` and `flags` expanded. All subsequent tables have them both listed as zero (e.g., `flags = 0`).

Code: Select all

>>> print (serpent.block (data.raw.fire["fire-flame"]))
... <snip> ...
  pictures = {                                                           
    {                                                                    
      animation_speed = 1,                                               
      axially_symmetrical = false,                                       
      blend_mode = "normal",                                             
      direction_count = 1,                                               
      filename = "__base__/graphics/entity/fire-flame/fire-flame-13.png",
      flags = {                                                          
        "compressed"                                                     
      },                                                                 
      frame_count = 25,                                                  
      height = 118,                                                      
      line_length = 8,                                                   
      scale = 0.5,                                                       
      shift = {                                                          
        -0.01953125,                                                     
        -0.453125                                                        
      },                                                                 
      tint = {                                                           
        a = 1,                                                           
        b = 1,                                                           
        g = 1,                                                           
        r = 1                                                            
      },                                                                 
      width = 60                                                         
    },                                                                   
    {                                                                    
      animation_speed = 1,                                               
      axially_symmetrical = false,                                       
      blend_mode = "normal",                                             
      direction_count = 1,                                               
      filename = "__base__/graphics/entity/fire-flame/fire-flame-12.png",
      flags = 0,                                                         
      frame_count = 25,                                                  
      height = 116,                                                      
      line_length = 8,                                                   
      scale = 0.5,                                                       
      shift = {                                                          
        -0.0078125,                                                      
        -0.45703250000000004                                             
      },                                                                 
      tint = 0,                                                          
      width = 63                                                         
    },                                                                   
... <snip> ...
However, if you loop on the individual tables in `.pictures`, it resolves properly.

Code: Select all

>>> for _, picture in pairs (data.raw.fire["fire-flame"].pictures) do
>>>     print (serpent.block (picture))
>>> end
{                                                                    
  animation_speed = 1,                                               
  axially_symmetrical = false,                                       
  blend_mode = "normal",                                             
  direction_count = 1,                                               
  filename = "__base__/graphics/entity/fire-flame/fire-flame-13.png",
  flags = {                                                          
    "compressed"                                                     
  },                                                                 
  frame_count = 25,                                                  
  height = 118,                                                      
  line_length = 8,                                                   
  scale = 0.5,                                                       
  shift = {                                                          
    -0.01953125,                                                     
    -0.453125                                                        
  },                                                                 
  tint = {                                                           
    a = 1,                                                           
    b = 1,                                                           
    g = 1,                                                           
    r = 1                                                            
  },                                                                 
  width = 60                                                         
}                                                                    
{                                                                    
  animation_speed = 1,                                               
  axially_symmetrical = false,                                       
  blend_mode = "normal",                                             
  direction_count = 1,                                               
  filename = "__base__/graphics/entity/fire-flame/fire-flame-12.png",
  flags = {                                                          
    "compressed"                                                     
  },                                                                 
  frame_count = 25,                                                  
  height = 116,                                                      
  line_length = 8,                                                   
  scale = 0.5,                                                       
  shift = {                                                          
    -0.0078125,                                                      
    -0.45703250000000004                                             
  },                                                                 
  tint = {                                                           
    a = 1,                                                           
    b = 1,                                                           
    g = 1,                                                           
    r = 1                                                            
  },                                                                 
  width = 63                                                         
}                                                                    

Re: [18.22] serpent.block reference

Posted: Sat May 09, 2020 10:43 pm
by Rseding91
Thanks for the report; that's working as intended. It puts a '0' in place to indicate it references a different already-existing table.