mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-23 23:53:44 +01:00
wea.parse.map: fix crash if keywords isn't specified
This commit is contained in:
parent
0dee65ca1d
commit
8891c47e98
@ -4,9 +4,10 @@ local wea = worldeditadditions
|
|||||||
-- For example, "count 25000 speed 0.8 rate_erosion 0.006 doawesome true" would be parsed into
|
-- 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 }.
|
-- the following table: { count = 25000, speed = 0.8, rate_erosion = 0.006, doawesome = true }.
|
||||||
-- @param params_text string The string to parse.
|
-- @param params_text string The string to parse.
|
||||||
-- @param keywords string[] A list of keywords. Keywords can be present on their own without a value. If found, their value will be automatically set to bool true.
|
-- @param keywords string[]? Optional. A list of keywords. Keywords can be present on their own without a value. If found, their value will be automatically set to bool true.
|
||||||
-- @returns table A table of key-value pairs parsed out from the given string.
|
-- @returns table A table of key-value pairs parsed out from the given string.
|
||||||
function worldeditadditions.parse.map(params_text, keywords)
|
function worldeditadditions.parse.map(params_text, keywords)
|
||||||
|
if not keywords then keywords = {} end
|
||||||
local result = {}
|
local result = {}
|
||||||
local parts = wea.split(params_text, "%s+", false)
|
local parts = wea.split(params_text, "%s+", false)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user