APercy / automobiles_pck

automobiles mod for minetest
MIT License
15 stars 8 forks source link

Crash #2

Closed minefaco closed 2 years ago

minefaco commented 2 years ago

2022-02-17 13:06:03: ERROR[Main]: ...s/automobiles_pck-main/automobiles_lib/ground_detection.lua:79: nesting of [[...]] is deprecated near '[' 2022-02-17 13:06:03: ERROR[Main]: stack traceback: 2022-02-17 13:06:03: ERROR[Main]: [C]: in function 'dofile' 2022-02-17 13:06:03: ERROR[Main]: .../automobiles_pck-main/automobiles_lib/init.lua:396: in main chunk 2022-02-17 13:06:03: ERROR[Main]: Revisa debug.txt para más detalles.

Minetest 5.5 with minetest game.

APercy commented 2 years ago

This doesn't make sense, the line 79 on ground_detection file is inside a commented block of code Try to update the code, please

Beanzilla commented 2 years ago

Currently in ground_detection.lua

-- Lines 71 to 85
            --[[if mid_car_level then
                deltaX = axis_distance/2;
                if mid_car_level.y ~= nil then
                    local deltaY_mid = mid_car_level.y - rear_obstacle_level.y;
                    if deltaY >= 1 and deltaY_mid < (deltaY / 2) then
                        --self.initial_properties.stepheight
                        pitch = math.rad(0)
                    end
                    --[[m = (deltaY_mid/deltaX)
                    local midpitch = math.atan(m)
                    if math.abs(math.deg(pitch) - math.deg(midpitch)) < 20 then
                        pitch = pitch + ((pitch - midpitch) / 2)
                    end]]--
                --[[end
            end]]--

Fix

-- Remove extra --[[ and ]]--
            --[[if mid_car_level then
                deltaX = axis_distance/2;
                if mid_car_level.y ~= nil then
                    local deltaY_mid = mid_car_level.y - rear_obstacle_level.y;
                    if deltaY >= 1 and deltaY_mid < (deltaY / 2) then
                        --self.initial_properties.stepheight
                        pitch = math.rad(0)
                    end
                    m = (deltaY_mid/deltaX)
                    local midpitch = math.atan(m)
                    if math.abs(math.deg(pitch) - math.deg(midpitch)) < 20 then
                        pitch = pitch + ((pitch - midpitch) / 2)
                    end
                end
            end]]--

P.S. --[[ can be closed simply by ]] (you don't need ]]--) but this only works for closing, opening still must be --[[.

As far as why the heck Lua is complaining about nested comments,

One reason could be, Lua is unable to identify which ]] (or ]]--) is closing which --[[.

APercy commented 2 years ago

I removed all now, that code isn't needed anymore =)