[Solved] How to fix attempt to index field 'player' (a nil value)?

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
Post Reply
Sander_Bouwhuis
Filter Inserter
Filter Inserter
Posts: 292
Joined: Mon Dec 07, 2015 10:45 pm
Contact:

[Solved] How to fix attempt to index field 'player' (a nil value)?

Post by Sander_Bouwhuis »

I had some simple mods that worked in v0.16.

All of them now fail with this error message : attempt to index field 'player' (a nil value)

This is where it fails in one of the mods in data.lua:

Code: Select all

data.raw.player.player.running_speed
Another of the mods fails here in data.lua:

Code: Select all

data.raw["player"]["player"].reach_distance = 10000
Yet another mod has this in data.lua:

Code: Select all

local mplayer = util.table.deepcopy(data.raw["player"]["player"])
mplayer.collision_box = {{0,0},{0,0}}
data:extend{mplayer}
And finally, another has this in data-final-fixes.luq:

Code: Select all

data.raw["player"]["player"].inventory_size = my_inventory_size

Everywhere 'player' is used it now fails. How can I change them to get them working again?

Thanks in advance for the help!
Last edited by Sander_Bouwhuis on Sun Jun 09, 2019 7:50 pm, edited 2 times in total.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: How to fix attempt to index field 'player' (a nil value)?

Post by eradicator »

The base "avatar" entity and it's prototype class were renamed.
Before:

Code: Select all

{
 type = 'player',
 name = 'player'
}

After:

Code: Select all

{
 type = 'character',
 name = 'character',
}
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: How to fix attempt to index field 'player' (a nil value)?

Post by disentius »

See this: 70313

Sander_Bouwhuis
Filter Inserter
Filter Inserter
Posts: 292
Joined: Mon Dec 07, 2015 10:45 pm
Contact:

Re: How to fix attempt to index field 'player' (a nil value)?

Post by Sander_Bouwhuis »

Oooooooooh, Disentius + Eradicator. I love you guys!
Thanks for the help!!! I managed to fix 5 mods.

What an annoying mod breaking change :evil:

Post Reply

Return to “Technical Help”