Page 1 of 1

[RESOLVED]Missing name or type in the following prototype

Posted: Sun Apr 10, 2016 8:51 am
by ScientistEric
So I've been working on a bridge between Side Inserters and DyTech, that when finished will add side inserter versions of all DyTech inserters. Recently though I've been getting a strange error :

Code: Select all

Missing name or type in the following prototype definition 
{
  {
    collision_box = {
      {
        -0.14999999999999999,
        -0.14999999999999999
      } --[[table: 000001D823A87E30]],
      {
        0.14999999999999999,
        0.14999999999999999
      } --[[table: 000001D823A86A50]]
    } --[[table: 000001D823A874D0]],
    corpse = "small-remnants",
    energy_per_movement = 5000,
    energy_per_rotation = 5000,
    energy_source = {
      drain = "0.4kW",
      type = "electric",
      usage_priority = "secondary-input"
    } --[[table: 000001D823A870B0]],
    extension_speed = 0.028000000000000001,
    fast_replaceable_group = "inserter",
    flags = {
      "placeable-neutral",
      "placeable-player",
      "player-creation"
    } --[[table: 000001D823A85310]],
    hand_base_picture = {
      filename = "__base__/graphics/entity/basic-inserter/basic-inserter-hand-base.png",
      height = 33,
      priority = "extra-high",
      width = 8
    } --[[table: 000001D823A87710]],
    hand_base_shadow = {
      filename = "__base__/graphics/entity/burner-inserter/burner-inserter-hand-base-shadow.png",
      height = 34,
      priority = "extra-high",
      width = 8
    } --[[table: 000001D823A878F0]],
    hand_closed_picture = {
      filename = "__base__/graphics/entity/basic-inserter/basic-inserter-hand-closed.png",
      height = 41,
      priority = "extra-high",
      width = 18
    } --[[table: 000001D823A86B70]],
    hand_closed_shadow = {
      filename = "__base__/graphics/entity/burner-inserter/burner-inserter-hand-closed-shadow.png",
      height = 41,
      priority = "extra-high",
      width = 18
    } --[[table: 000001D823A875F0]],
    hand_open_picture = {
      filename = "__base__/graphics/entity/basic-inserter/basic-inserter-hand-open.png",
      height = 41,
      priority = "extra-high",
      width = 18
    } --[[table: 000001D823A87F50]],
    hand_open_shadow = {
      filename = "__base__/graphics/entity/burner-inserter/burner-inserter-hand-open-shadow.png",
      height = 41,
      priority = "extra-high",
      width = 18
    } --[[table: 000001D823A86D50]],
    icon = "__Side Inserters__/graphics/icons/inserter-close-left.png",
    insert_position = {
      1.2,
      0
    } --[[table: 000001D823A87E90]],
    max_health = 40,
    minable = {
      hardness = 0.20000000000000001,
      mining_time = 0.5,
      result = "inserter-close"
    } --[[table: 000001D823A872F0]],
    name = "inserter-close-left",
    pickup_position = {
      0,
      -1
    } --[[table: 000001D823A86AB0]],
    platform_picture = {
      sheet = {
        filename = "__base__/graphics/entity/basic-inserter/basic-inserter-platform.png",
        height = 46,
        priority = "extra-high",
        width = 46
      } --[[table: 000001D823A86DB0]]
    } --[[table: 000001D823A87FB0]],
    resistances = {
      {
        percent = 90,
        type = "fire"
      } --[[table: 000001D823A87110]]
    } --[[table: 000001D823A86F90]],
    rotation_speed = 0.0097999999999999997,
    selection_box = {
      {
        -0.40000000000000002,
        -0.34999999999999998
      } --[[table: 000001D823A87C50]],
      {
        0.40000000000000002,
        0.45000000000000001
      } --[[table: 000001D823A86FF0]]
    } --[[table: 000001D823A87170]],
    type = "inserter",
    working_sound = {
      match_progress_to_activity = false,
      sound = {
        {
          filename = "__base__/sound/inserter-basic-1.ogg",
          volume = 0.75
        } --[[table: 000001D823A86CF0]],
        {
          filename = "__base__/sound/inserter-basic-2.ogg",
          volume = 0.75
        } --[[table: 000001D823A87530]],
        {
          filename = "__base__/sound/inserter-basic-3.ogg",
          volume = 0.75
        } --[[table: 000001D823A86C90]],
        {
          filename = "__base__/sound/inserter-basic-4.ogg",
          volume = 0.75
        } --[[table: 000001D823A86E70]],
        {
          filename = "__base__/sound/inserter-basic-5.ogg",
          volume = 0.75
        } --[[table: 000001D823A87590]]
      } --[[table: 000001D823A871D0]]
    } --[[table: 000001D823A869F0]]
  }
Here's the code it's having trouble with :

Code: Select all

inserter_close_left = util.table.deepcopy(data.raw["inserter"]["inserter-close"])
inserter_close_left.name = "inserter-close-left"
inserter_close_left.icon = "__Side Inserters__/graphics/icons/inserter-close-left.png"
inserter_close_left.working_sound.match_progress_to_activity = MATCH_SOUND_PROGRESS_TO_ACTIVITY
inserter_close_left.insert_position = {INSERT_POSITION, 0}
inserter_close_left.rotation_speed = inserter_close_left.rotation_speed * SIDE_SPEED_FACTOR
I have this same code for each Dytech inserter and there right version and I'd rather not have to go back and change each of them manually to not use deepcopy.
So what can I do to fix it?

Thanks for your time!

Re: Missing name or type in the following prototype definition

Posted: Sun Apr 10, 2016 11:17 am
by Adil
ScientistEric wrote:

Code: Select all

Missing name or type in the following prototype definition 
{--THIS is the problem
  {
    --snip
    } --[[table: 000001D823A869F0]]
  }
Check the way how you insert them back into data.
If you're putting them into intermediate table, you use that name directrly without additional brackets:

Code: Select all

new_etities={}
new_entity=somecode
table.insert(new_entities,new_entity)
data:extend(new_entities)
--or
data:extend({new_entity})
--or
data:extend{new_entity}
not any of the following

Code: Select all

table.insert(new_entities,{new_entity})
data:extend{new_entities}

Re: Missing name or type in the following prototype definition

Posted: Sun Apr 10, 2016 6:14 pm
by ScientistEric
Awesome that fixed it Thanks ! :D
Now just to finish up on the graphics then I can get testing!