Fix the string.split bug by adding a new string.split2 function

master
Joachim Stolberg 2021-11-28 14:39:45 +01:00
parent 16109ec3f6
commit d8df3b32da
3 changed files with 7 additions and 3 deletions

View File

@ -61,11 +61,14 @@ local BASE_ENV = {
if separator == "" then separator = " " end
return safer_lua.Array(unpack(string.split(str, separator, include_empty, max_splits, sep_is_pattern)))
end,
split2 = function(str, separator, include_empty, max_splits, sep_is_pattern)
if separator == "" then separator = " " end
return unpack(string.split(str, separator, include_empty, max_splits, sep_is_pattern))
end,
trim = string.trim,
},
tonumber = tonumber,
tostring = tostring,
unpack = unpack,
type = type,
ticks = 0,
}

View File

@ -15,7 +15,7 @@
safer_lua = {}
-- Version for compatibility checks, see readme.md/history
safer_lua.version = 1.0
safer_lua.version = 1.01
dofile(minetest.get_modpath("safer_lua") .. "/data_struct.lua")
dofile(minetest.get_modpath("safer_lua") .. "/scanner.lua")

View File

@ -8,7 +8,7 @@ A subset of the language Lua for safe and secure Lua sandboxes with:
- limited posibilities to call functions
### License
Copyright (C) 2018-2020 Joachim Stolberg
Copyright (C) 2018-2021 Joachim Stolberg
Code: Licensed under the GNU LGPL version 2.1 or later. See LICENSE.txt
@ -18,3 +18,4 @@ none
### History
- 2018-06-24 v0.01 * first draft
- 2020-03-14 v1.00 * extracted from TechPack and released
- 2021-11-28 v1.01 * function `string.split2` added, `unpack` removed