Activate minetest.deserialize safety
This commit is contained in:
parent
84b1cdd2c8
commit
3978b14a29
8
init.lua
8
init.lua
@ -1,7 +1,7 @@
|
||||
playerphysics = {}
|
||||
|
||||
local function calculate_attribute_product(player, attribute)
|
||||
local a = minetest.deserialize(player:get_meta():get_string("playerphysics:physics"))
|
||||
local a = minetest.deserialize(player:get_meta():get_string("playerphysics:physics"), true)
|
||||
local product = 1
|
||||
if a == nil or a[attribute] == nil then
|
||||
return product
|
||||
@ -17,7 +17,7 @@ end
|
||||
|
||||
function playerphysics.add_physics_factor(player, attribute, id, value)
|
||||
local meta = player:get_meta()
|
||||
local a = minetest.deserialize(meta:get_string("playerphysics:physics"))
|
||||
local a = minetest.deserialize(meta:get_string("playerphysics:physics"), true)
|
||||
if a == nil then
|
||||
a = { [attribute] = { [id] = value } }
|
||||
elseif a[attribute] == nil then
|
||||
@ -32,7 +32,7 @@ end
|
||||
|
||||
function playerphysics.remove_physics_factor(player, attribute, id)
|
||||
local meta = player:get_meta()
|
||||
local a = minetest.deserialize(meta:get_string("playerphysics:physics"))
|
||||
local a = minetest.deserialize(meta:get_string("playerphysics:physics"), true)
|
||||
if a == nil or a[attribute] == nil then
|
||||
-- Nothing to remove
|
||||
return
|
||||
@ -46,7 +46,7 @@ end
|
||||
|
||||
function playerphysics.get_physics_factor(player, attribute, id)
|
||||
local meta = player:get_meta()
|
||||
local a = minetest.deserialize(meta:get_string("playerphysics:physics"))
|
||||
local a = minetest.deserialize(meta:get_string("playerphysics:physics"), true)
|
||||
if a == nil then
|
||||
return nil
|
||||
elseif a[attribute] == nil then
|
||||
|
Loading…
x
Reference in New Issue
Block a user