Page 1 of 1

[Solved][0.15.5] LuaEntity doesn't contain key x

Posted: Mon May 01, 2017 4:27 pm
by Fumelfo
Hi !
This is my first post, and please don't be rude if there's already a post on the topic, but I did some research with no result.

Let me show you a simple picture describing my problem :
Image

!!! I get an error on lines 10 and 11 if the previous ones are commented !!! Is this some bug with player_armor ?

The code used is the one from https://wiki.factorio.com/User:Gangsir/moddingTutorial . I'm a bit angry (at myself/ at code ?) because I looked over the API and found no reason for my code not to work.
Any body has suggestion ? (Ps : I get the same error without checking for character, but Apparently, defines.inventory can be nil if the player has no character, but that shouldn't be an issue for a simple item mod)

Thank you for your help !
Fumelgo

Re: [0.15.5] LuaEntity doesn't contain key x

Posted: Mon May 01, 2017 5:30 pm
by Fumelfo
Ok, so I must have had a different error at the beginning, but this time, the error is : print is not defined for player.get_inventory(defines.inventory.player_armor). I used a little tostring() and it was printed (function pos in ram), and mod loads fine with base code from tutorial.
Can't remember initial error wich made me try to print it. Anyways, case closed. That was strange. Guess it's a kind of "reboot computer and strangely it works".

I hate why it doesn't work and I don't know why.
I hate it also when it works and I don't know why.

Have a good day.