https://github.com/YagaoDirac/Bug-repor ... t-download
Directly run the scenario.
The bug occurs within a second.
In log, it's very clear. A very strange behavior happens. Inside the add function of array_simple, a field of the added element is removed.
The array_simple is a container. It works properly. I used it in Ore Beach.
So, what can I do with the bug?
A very normal assignment fails in lua.
-
- Fast Inserter
- Posts: 152
- Joined: Sun Jun 16, 2019 4:04 pm
- Contact:
Re: A very normal assignment fails in lua.
Things not to do when requesting help:
- making reproduction as unhelpful as possible (not providing direct zip, forcing to download git repo)
- not providing any details as to what error it produces, making it literally required to download whatever it is and run.
- providing full code without any size reduction, not narrowing onto the issue.
I would say it is really rude, if you want help, please be helpful from your side.
Only issue i see is this:
And it literally says what is wrong: "No character".
This is common issue to solve due to freeplay starting cutscene.
After finally finding hints to move this to scenario, I get this error:
But this looks like a programming issue on your side so i am not trying to debug that.
- making reproduction as unhelpful as possible (not providing direct zip, forcing to download git repo)
- not providing any details as to what error it produces, making it literally required to download whatever it is and run.
- providing full code without any size reduction, not narrowing onto the issue.
I would say it is really rude, if you want help, please be helpful from your side.
Only issue i see is this:
Code: Select all
Error while running event BiterOre::on_player_created (ID 25)
No character.
stack traceback:
[C]: in function '__newindex'
__BiterOre__/control.lua:315: in function 'set_character_modifier'
__BiterOre__/control.lua:346: in function <__BiterOre__/control.lua:336>
This is common issue to solve due to freeplay starting cutscene.
After finally finding hints to move this to scenario, I get this error:
Code: Select all
Error while running event level::on_chunk_generated (ID 12)
...ly-playing/src/Component-bitore_source_content_biter.lua:13: attempt to perform arithmetic on field 'amount_per_minute' (a nil value)
stack traceback:
...ly-playing/src/Component-bitore_source_content_biter.lua:13: in function <...ly-playing/src/Component-bitore_source_content_biter.lua:12>
Re: A very normal assignment fails in lua.
3 wrong bug reports, which are revealing themselves as modding help topics, in short time is also a bit taxing, i would assume.
-
- Fast Inserter
- Posts: 152
- Joined: Sun Jun 16, 2019 4:04 pm
- Contact:
Re: A very normal assignment fails in lua.
If you have looked at the log just lines above the final error info, you would find that, a table with a field named "amount_per_minute" is gone after a line like.
Code: Select all
cont[index] = this table.
I don't believe it's possible to do "wild pointer" in lua.
Re: A very normal assignment fails in lua.
If you can post the whole code snippet related we can try to helpyagaodirac wrote: ↑Thu Apr 22, 2021 11:48 am The container should be very correct. Then what is the problem?
For many years and many thousands of Lua mods, nobody has had problems with the Lua, so generally if something is crashing is it most likely your own mistake
-
- Fast Inserter
- Posts: 152
- Joined: Sun Jun 16, 2019 4:04 pm
- Contact:
Re: A very normal assignment fails in lua.
OK, thanks. I plan to assemble all the parts in that project again to see what goes wrong. By the way, I found that it's not practical to set the metatable in on_load when the data structure and relationship scale and get complex. Would you consider doing it in your cpp code?
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: A very normal assignment fails in lua.
Recursive reattachment is far from impractical. Just look and learn how other mods do it.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.