Need help with " ')' expected near '.' "-error

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Trblz
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Thu Sep 21, 2017 1:23 am
Contact:

Need help with " ')' expected near '.' "-error

Post by Trblz »

I've been having this error with a scenario that i build:
...Data/Roaming/Factorio/temp/currently-playing/control.lua:57: ...ta/Roaming/Factorio/temp/currently-playing/maps/grid.lua:120: ')' expected near '.'
stack traceback:
[C]: in function 'require'
...Data/Roaming/Factorio/temp/currently-playing/control.lua:57: in main chunk
but after looking at the code for hours for the mistake i need some help. The function that fails (grid.lua:120) is below tough i've attached the entire grid.lua as part of the zip file.

Code: Select all

function grid_remove_ore_in_chunk(event.area)

    local area = event.area
    local entitiesSpawned = game.surfaces["nauvis"].find_entities({area.left_top.x, area.left_top.y}, {area.right_bottom.x, area.right_bottom.y})
	
    for _,v in pairs(entitiesSpawned) do
      if(v.type == "resource" or v.type == "decorative") then
        v.destroy()
      end
    end
end
TIA!
Attachments
grid randmom bridges.zip
(43.87 KiB) Downloaded 75 times
My Mod list: Necormant co-author

SyncViews
Filter Inserter
Filter Inserter
Posts: 295
Joined: Thu Apr 21, 2016 3:17 pm
Contact:

Re: Need help with " ')' expected near '.' "-error

Post by SyncViews »

You should indicate which line is 120.

But this bit is wrong, Lua parameter names can not contain a dot. Lua variable and function names are generally short and lower case, if you do want two words, an underscore may be used "event_area".

Code: Select all

function grid_remove_ore_in_chunk(event.area)

eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: Need help with " ')' expected near '.' "-error

Post by eduran »

Use event, not event.area as function argument. Alternatively, if you call your function with event.area as argument, change it to area and get rid of the first line inside your function.

User avatar
Trblz
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Thu Sep 21, 2017 1:23 am
Contact:

Re: Need help with " ')' expected near '.' "-error

Post by Trblz »

Thanks

that solved that bug
My Mod list: Necormant co-author

Post Reply

Return to “Modding help”