Page 1 of 1

[SOLVED]Attempt to call a nil value

Posted: Fri May 28, 2021 10:11 am
by CruWiT
I just test some code from https://lua-api.factorio.com/latest/
This is error when I try start new game.

Code: Select all

__Functionals__/control.lua:1: attempt to call a nil value
stack traceback:
	__Functionals__/control.lua:1: in main chunk
this is my control.lua;

Code: Select all

script.on_event
(
	defines.events.on_built_entity, 
	function(event)
		local yaratilan_entity = event.created_entity
		local oyuncu_index = event.player_index
		local esas_oyuncu = game.get_player(oyuncu_index)
		local item_stack = event.stack
		local item = event.item
		local taglar = event.tags
		
		if esas_oyuncu.character ~= nil then
			esas_oyuncu.character_running_speed_modifier = 0.9
			game.print("Fonksiyon basariyla calisti.")
		end
	end,
	{
		{
			filter = "type",
			type = "wall"
		},
		{
			filter = "vehicle",
			mode = "or",
		},
		{
			filter = "name",
			name = "small-lamp",
			mode = "or"
		}
	}
)
What's wrong here?

note: Game version is Factorio 1.1.34

edit: I have no idea what happened. But I'm reload game and try again new game. mod completely working. Maybe my first launch the version 1.1.34 is a problem I don't know but it's fine now.

Re: Attempt to call a nil value

Posted: Fri May 28, 2021 10:20 am
by DaveMcW
Your control.lua code works for me. What other mods do you have installed?

Re: Attempt to call a nil value

Posted: Fri May 28, 2021 10:26 am
by CruWiT
DaveMcW wrote:
Fri May 28, 2021 10:20 am
Your control.lua code works for me. What other mods do you have installed?
nothing just use this mod.

Re: Attempt to call a nil value

Posted: Fri May 28, 2021 10:38 am
by DaveMcW
Can you zip the mod and attach it to a post?

Re: Attempt to call a nil value

Posted: Fri May 28, 2021 10:46 am
by CruWiT
DaveMcW wrote:
Fri May 28, 2021 10:38 am
Can you zip the mod and attach it to a post?
Mod is work now thanks for try to help

Re: [SOLVED]Attempt to call a nil value

Posted: Fri May 28, 2021 4:40 pm
by DarkShadow44
For completeness it's always appreciated if you tell us what the problem was. You know, in case someone comes across this when googling. ;)