mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-01 05:43:01 +00:00
weac.parse.map: add nil check via assertion
This commit is contained in:
parent
717a651bd8
commit
7b43e4b201
1 changed files with 5 additions and 0 deletions
|
@ -4,6 +4,8 @@ local wea_c = worldeditadditions_core
|
|||
---
|
||||
-- @module worldeditadditions_core.parse
|
||||
|
||||
|
||||
|
||||
--- Parses a map of key-value pairs into a table.
|
||||
-- For example, "count 25000 speed 0.8 rate_erosion 0.006 doawesome true" would be parsed into
|
||||
-- the following table: { count = 25000, speed = 0.8, rate_erosion = 0.006, doawesome = true }.
|
||||
|
@ -25,6 +27,9 @@ local function parse_map(params_text, keywords)
|
|||
-- Look for bools
|
||||
if part_converted == "true" then part_converted = true end
|
||||
if part_converted == "false" then part_converted = false end
|
||||
if last_key == nil then
|
||||
return false, "Error: nil check assertion in worldeditadditions_core.parse.map:state/mode/VALUE failed."
|
||||
end
|
||||
result[last_key] = part_converted
|
||||
mode = "KEY"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue