Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Param type mismatch in trivial script.on_event #68

Closed
Bilka2 opened this issue Aug 15, 2022 · 1 comment
Closed

Param type mismatch in trivial script.on_event #68

Bilka2 opened this issue Aug 15, 2022 · 1 comment

Comments

@Bilka2
Copy link
Contributor

Bilka2 commented Aug 15, 2022

Code in control.lua:

script.on_event(defines.events.on_player_created, function(event)

  -- Enable map editor for the player
  local player = game.get_player(event.player_index) ---@cast player -nil
  player.toggle_map_editor()
end)

Problem:
defines.events.on_player_created has a squiggly, complains about
"Cannot assign integer|defines.events.on_player_created to parameter string|defines.events|defines.events[].Lua Diagnostics.(param-type-mismatch)"

More info:
Version 3.5.3 of sumneko.lua
Version 1.1.22 of justarandomgeek.factoriomod-debug
Latest master of JanSharp/FactorioSumnekoLuaPlugin (JanSharp/FactorioSumnekoLuaPlugin@82c4053)
Factorio version 1.1.65 (self generated docs on 754f85d)

The type of event.player_index seems to work, it is EventData.on_player_created|on_player_created.player_index: uint.

It is not clear to me whether the problem is with the plugin or with the generated types by the debugger. According to the plugin readme, it should not touch the first on_event function argument, so I am reporting the issue here for now.

@Bilka2
Copy link
Contributor Author

Bilka2 commented Aug 15, 2022

Duh, found the issue. The old runtime-api.lua from previous debugger version was still in my Lua.workspace.library setting. Seems like the debugger added a bunch of junk to that setting too, without any notification.

Edit: Created #72 and #73 regarding the junk that was added to the workspace library setting.

@Bilka2 Bilka2 closed this as completed Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant