PyBlock


Pymod edition of a Sea Block style game

Content
7 months ago
0.16 - 1.1
3.32K

b Non-recoverable error when exploring.

3 years ago

6644.888 Error MainLoop.cpp:1281: Exception at tick 1228575: The mod PyBlock (0.2.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event PyBlock::on_chunk_generated (ID 12)
Entity name not specified.
stack traceback:
[C]: in function 'create_entity'
PyBlock/control.lua:320: in function <PyBlock/control.lua:189>

3 years ago
local Rocks = {
    'iron-rock', 'copper-rock', 'uranium-rock', 'zinc-rock', 'aluminium-rock', 'chromium-rock', 'coal-rock',
    'lead-rock', 'nexelit-rock', 'nickel-rock', 'phosphate-rock-02', 'quartz-rock', 'salt-rock', 'tin-rock',
    'titanium-rock', 'volcanic-pipe', 'regolites', 'rare-earth-bolide', 'phosphate-rock', 'sulfur-patch',
    'bitumen-seep'
} -- 21 elements

    local SelectedRock = math.random(1, 25)
    local rock = Rocks[SelectedRock]

I'm not sure what lua does in the case of array overflow, but this looks like what's causing the error.

3 years ago
local Rocks = {
    'iron-rock', 'copper-rock', 'uranium-rock', 'zinc-rock', 'aluminium-rock', 'chromium-rock', 'coal-rock',
    'lead-rock', 'nexelit-rock', 'nickel-rock', 'phosphate-rock-02', 'quartz-rock', 'salt-rock', 'tin-rock',
    'titanium-rock', 'volcanic-pipe', 'regolites', 'rare-earth-bolide', 'phosphate-rock', 'sulfur-patch',
    'bitumen-seep'
} -- 21 elements

    local SelectedRock = math.random(1, 25)
    local rock = Rocks[SelectedRock]

I'm not sure what lua does in the case of array overflow, but this looks like what's causing the error.

it would give a nil result or something similar and it would crash as you can see. ill get this fixed. i removed 4 things from the list to be updated to the last pyph and forgot to update the count.

3 years ago
(updated 3 years ago)

0.2.1 is up and should fix this

3 years ago

Works! Quick question, why not use local SelectedRock = math.random(#Rocks)? It'd always be correct for whatever length of list.

New response