MillhioreBT / forgottenserver-downgrade

TFS Downgrade 1.5+ is an engine based on nekiro downgrade but highly updated with current tfs code, it also has the lua modules divided and uses lua5.4
GNU General Public License v2.0
19 stars 18 forks source link

Compatibility issue when using Json.lua causes errors in other Lua scripts #29

Open sppeect opened 5 months ago

sppeect commented 5 months ago

Title: Compatibility issue when using Json.lua causes errors in other Lua scripts

Description: When using Json.lua located in lib/core, other Lua scripts are breaking, resulting in errors. Below are two examples of errors that occur:

Exemple 1:

2024-06-18 02:29:27 - Lua Script Error: [Scripts Interface]
2024-06-18 02:29:27 - /home/healmot/server/data/scripts/weapons/wands.lua
2024-06-18 02:29:27 - /home/healmot/server/data/scripts/weapons/wands.lua:1: attempt to index a nil value (global 'classBalancerConfig')
2024-06-18 02:29:27 - stack traceback:
2024-06-18 02:29:27 - [C]: in metamethod 'index'

On script global.lua:

classBalancerConfig = {
    knight = {
        damageMultiplierMin = 2.5,
        damageMultiplierMax = 5,
        defense = 10
    },
    paladin = {
        damageMultiplierMin = 4,
        damageMultiplierMax = 8,
        defense = 8.5
    },
    druid = {
        damageMultiplierMin = 3.25,
        damageMultiplierMax = 6.5,
        defense = 3
    },
    sorcerer = {
        damageMultiplierMin = 4.75,
        damageMultiplierMax = 9.5,
        defense = 2
    }
}

Exemple 2 :

2024-06-18 02:52:31 - Lua Script Error: [Scripts Interface]
2024-06-18 02:52:31 - /home/healmot/server/data/scripts/UpgradeSystem/core.lua
2024-06-18 02:52:31 - /home/healmot/server/data/scripts/UpgradeSystem/core.lua:19: attempt to index a CreatureEvent value (local 'LoginEvent')
2024-06-18 02:52:31 - stack traceback:
2024-06-18 02:52:31 - [C]: in metamethod 'newindex'
2024-06-18 02:52:31 - /home/healmot/server/data/scripts/UpgradeSystem/core.lua:19: in main chunk
Najtu commented 5 months ago

Not sure what json.lua implementation you are using, but most json.lua i found on github do not support LUA 5.4

You would need to find one that supports it.