made function get_number_from_id accessible

This commit is contained in:
Sokomine 2021-06-21 18:22:37 +02:00
parent fe683adefb
commit f7470a7bb1
3 changed files with 6 additions and 6 deletions

View File

@ -374,7 +374,7 @@ yl_speak_up.execute_effect = function(player, n_id, o_id, r)
if target_pos_valid == false then if target_pos_valid == false then
local obj = yl_speak_up.speak_to[pname].obj local obj = yl_speak_up.speak_to[pname].obj
local n_id = yl_speak_up.speak_to[pname].n_id local n_id = yl_speak_up.speak_to[pname].n_id
local npc = get_number_from_id(n_id) local npc = yl_speak_up.get_number_from_id(n_id)
if obj:get_luaentity() and tonumber(npc) then if obj:get_luaentity() and tonumber(npc) then
yl_speak_up.log_change(pname, n_id, tostring(r.r_id)..": ".. yl_speak_up.log_change(pname, n_id, tostring(r.r_id)..": "..
"NPC at "..minetest.pos_to_string(obj:get_pos(),0).. "NPC at "..minetest.pos_to_string(obj:get_pos(),0)..

View File

@ -96,7 +96,7 @@ yl_speak_up.eval_and_execute_function = function(player, x_v, id_prefix)
if code:byte(1) == 27 then if code:byte(1) == 27 then
local obj = yl_speak_up.speak_to[pname].obj local obj = yl_speak_up.speak_to[pname].obj
local n_id = yl_speak_up.speak_to[pname].n_id local n_id = yl_speak_up.speak_to[pname].n_id
local npc = get_number_from_id(n_id) local npc = yl_speak_up.get_number_from_id(n_id)
if obj:get_luaentity() and tonumber(npc) then if obj:get_luaentity() and tonumber(npc) then
minetest.log("error","[MOD] yl_speak_up: NPC with ID n_"..npc.." at position "..minetest.pos_to_string(obj:get_pos(),0).." could not compile the content of "..x_id.." :"..dump(code) .. " because of illegal bytecode for player "..pname) minetest.log("error","[MOD] yl_speak_up: NPC with ID n_"..npc.." at position "..minetest.pos_to_string(obj:get_pos(),0).." could not compile the content of "..x_id.." :"..dump(code) .. " because of illegal bytecode for player "..pname)
else else
@ -113,7 +113,7 @@ yl_speak_up.eval_and_execute_function = function(player, x_v, id_prefix)
if not f then if not f then
local obj = yl_speak_up.speak_to[pname].obj local obj = yl_speak_up.speak_to[pname].obj
local n_id = yl_speak_up.speak_to[pname].n_id local n_id = yl_speak_up.speak_to[pname].n_id
local npc = get_number_from_id(n_id) local npc = yl_speak_up.get_number_from_id(n_id)
if obj:get_luaentity() and tonumber(npc) then if obj:get_luaentity() and tonumber(npc) then
minetest.log("error","[MOD] yl_speak_up: NPC with ID n_"..npc.." at position "..minetest.pos_to_string(obj:get_pos(),0).." could not compile the content of "..x_id.." :"..dump(code) .. " for player "..pname) minetest.log("error","[MOD] yl_speak_up: NPC with ID n_"..npc.." at position "..minetest.pos_to_string(obj:get_pos(),0).." could not compile the content of "..x_id.." :"..dump(code) .. " for player "..pname)
else else
@ -127,7 +127,7 @@ yl_speak_up.eval_and_execute_function = function(player, x_v, id_prefix)
if not ok then if not ok then
local obj = yl_speak_up.speak_to[pname].obj local obj = yl_speak_up.speak_to[pname].obj
local n_id = yl_speak_up.speak_to[pname].n_id local n_id = yl_speak_up.speak_to[pname].n_id
local npc = get_number_from_id(n_id) local npc = yl_speak_up.get_number_from_id(n_id)
if obj:get_luaentity() and tonumber(npc) then if obj:get_luaentity() and tonumber(npc) then
minetest.log("error","[MOD] yl_speak_up: NPC with ID n_"..npc.." at position "..minetest.pos_to_string(obj:get_pos(),0).." could not execute the content of "..x_id.." :"..dump(code) .. " for player "..pname) minetest.log("error","[MOD] yl_speak_up: NPC with ID n_"..npc.." at position "..minetest.pos_to_string(obj:get_pos(),0).." could not execute the content of "..x_id.." :"..dump(code) .. " for player "..pname)
else else

View File

@ -88,7 +88,7 @@ local function get_result_types()
return s_grt, t_grt return s_grt, t_grt
end end
local function get_number_from_id(any_id) yl_speak_up.get_number_from_id = function(any_id)
return string.split(any_id, "_")[2] return string.split(any_id, "_")[2]
end end
@ -117,7 +117,7 @@ yl_speak_up.find_next_id = function(t)
local keynum = 1 local keynum = 1
for k, _ in pairs(t) do for k, _ in pairs(t) do
local keynum = tonumber(get_number_from_id(k)) local keynum = tonumber(yl_speak_up.get_number_from_id(k))
if keynum >= start_id then if keynum >= start_id then
start_id = keynum + 1 start_id = keynum + 1
end end