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

Anything that prevents you play the game properly. Do you have issues with paying for the game, downloading it or properly running it on your computer? Let us know here.
Post Reply
Sander_Bouwhuis
Fast Inserter
Fast Inserter
Posts: 245
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 » Sun Jun 09, 2019 5:47 pm

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: 3057
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post by eradicator » Sun Jun 09, 2019 6:56 pm

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: Hand Crank Generator, Screenshot Hotkey 2.0
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

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

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

Post by disentius » Sun Jun 09, 2019 7:11 pm

See this: 70313

Sander_Bouwhuis
Fast Inserter
Fast Inserter
Posts: 245
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 » Sun Jun 09, 2019 7:48 pm

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”

Who is online

Users browsing this forum: No registered users