mirror of
https://github.com/appgurueu/modlib.git
synced 2024-08-19 21:04:13 +02:00
B3D test: Close stream as early as possible
This commit is contained in:
parent
eef3ea9c57
commit
e8722e3dac
5
test.lua
5
test.lua
@ -477,9 +477,9 @@ local tests = {
|
|||||||
liquid_raycast = false
|
liquid_raycast = false
|
||||||
}
|
}
|
||||||
if tests.b3d then
|
if tests.b3d then
|
||||||
local stream = io.open(mod.get_resource("player_api", "models", "character.b3d"), "r")
|
local stream = assert(io.open(mod.get_resource("player_api", "models", "character.b3d"), "r"))
|
||||||
assert(stream)
|
|
||||||
local b3d = b3d.read(stream)
|
local b3d = b3d.read(stream)
|
||||||
|
stream:close()
|
||||||
--! dirty helper method to create truncate tables with 10+ number keys
|
--! dirty helper method to create truncate tables with 10+ number keys
|
||||||
local function _b3d_truncate(table)
|
local function _b3d_truncate(table)
|
||||||
local count = 1
|
local count = 1
|
||||||
@ -502,7 +502,6 @@ if tests.b3d then
|
|||||||
return table
|
return table
|
||||||
end
|
end
|
||||||
file.write(mod.get_resource"character.b3d.lua", "return " .. dump(_b3d_truncate(table.copy(b3d))))
|
file.write(mod.get_resource"character.b3d.lua", "return " .. dump(_b3d_truncate(table.copy(b3d))))
|
||||||
stream:close()
|
|
||||||
end
|
end
|
||||||
local vector, minetest, ml_mt = _G.vector, _G.minetest, minetest
|
local vector, minetest, ml_mt = _G.vector, _G.minetest, minetest
|
||||||
if tests.liquid_dir then
|
if tests.liquid_dir then
|
||||||
|
Loading…
Reference in New Issue
Block a user