mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Fix undeclared globals in functions and shorten lines in misc_helpers.lua.
This commit is contained in:
parent
fb80a7c111
commit
f114fc74d6
@ -463,7 +463,8 @@ function core.explode_table_event(evt)
|
|||||||
local t = parts[1]:trim()
|
local t = parts[1]:trim()
|
||||||
local r = tonumber(parts[2]:trim())
|
local r = tonumber(parts[2]:trim())
|
||||||
local c = tonumber(parts[3]:trim())
|
local c = tonumber(parts[3]:trim())
|
||||||
if type(r) == "number" and type(c) == "number" and t ~= "INV" then
|
if type(r) == "number" and type(c) == "number"
|
||||||
|
and t ~= "INV" then
|
||||||
return {type=t, row=r, column=c}
|
return {type=t, row=r, column=c}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -532,16 +533,18 @@ if INIT == "mainmenu" then
|
|||||||
local arg = {n=select('#', ...), ...}
|
local arg = {n=select('#', ...), ...}
|
||||||
if arg.n >= 1 then
|
if arg.n >= 1 then
|
||||||
-- Insert positional parameters ($1, $2, ...)
|
-- Insert positional parameters ($1, $2, ...)
|
||||||
result = ''
|
local result = ''
|
||||||
pos = 1
|
local pos = 1
|
||||||
while pos <= text:len() do
|
while pos <= text:len() do
|
||||||
newpos = text:find('[$]', pos)
|
local newpos = text:find('[$]', pos)
|
||||||
if newpos == nil then
|
if newpos == nil then
|
||||||
result = result .. text:sub(pos)
|
result = result .. text:sub(pos)
|
||||||
pos = text:len() + 1
|
pos = text:len() + 1
|
||||||
else
|
else
|
||||||
paramindex = tonumber(text:sub(newpos+1, newpos+1))
|
local paramindex =
|
||||||
result = result .. text:sub(pos, newpos-1) .. tostring(arg[paramindex])
|
tonumber(text:sub(newpos+1, newpos+1))
|
||||||
|
result = result .. text:sub(pos, newpos-1)
|
||||||
|
.. tostring(arg[paramindex])
|
||||||
pos = newpos + 2
|
pos = newpos + 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user