Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行状态:LUA_错误:[字符串“devils_catacomb”]:1:尝试调用字段“get_devil_base”(一个空值)_Lua - Fatal编程技术网

运行状态:LUA_错误:[字符串“devils_catacomb”]:1:尝试调用字段“get_devil_base”(一个空值)

运行状态:LUA_错误:[字符串“devils_catacomb”]:1:尝试调用字段“get_devil_base”(一个空值),lua,Lua,嗨,我的英语不好,我有个问题 错误 SYSERR:Apr 11 14:16:12::RunState:LUA_ERROR:[字符串devils_catacomb]:1:尝试将字段“get_devil_base”调用为空值 系统错误:Apr 11 14:16:12::WriterRunningStateToSyser:LUA_错误:quest>devils_catacomb.start单击 SYSERR:Apr 11 14:12:32::RunState:LUA_错误:>locale/turkey

嗨,我的英语不好,我有个问题

错误

SYSERR:Apr 11 14:16:12::RunState:LUA_ERROR:[字符串devils_catacomb]:1:尝试将字段“get_devil_base”调用为空值 系统错误:Apr 11 14:16:12::WriterRunningStateToSyser:LUA_错误:quest>devils_catacomb.start单击 SYSERR:Apr 11 14:12:32::RunState:LUA_错误:>locale/turkey/quest/object/state/DevicePower_区域:1:尝试将全局“位置”索引为零值 SYSERR:Apr 11 14:12:32::writerunningstatetoserr:LUA\u错误:quest>devicepower\u区域。开始单击 我的恶魔力量之地

////////Error formed location/////////

function get_4floor_stone_pos()
    local positions,j,t = {{368, 629}, {419, 630}, {428, 653}, {422, 679},
{395, 689}, {369, 679}, {361, 658},},number(i,7), positions[i];
    for i = 1, 6 do
        if (i != j) then
            local t = positions[i];
            positions[i] = positions[j];
            positions[j] = t;
        end
    end
    return positions
end

when 8016.kill with pc.get_map_index() >= 660000 and pc.get_map_index() < 
670000 begin
    d.setf("level", 4)
    local positions,vid = deviltower_zone.get_4floor_stone_pos() 
,d.spawn_mob(8017, positions[7][1], positions[7][2])
    for i = 1, 6 do d.set_unique("fake" .. i , d.spawn_mob(8017, 
positions[i][1], positions[i][2])) end
    d.set_unique("real", vid)
    server_loop_timer('devil_stone4_update', 10, pc.get_map_index())
    server_timer('devil_stone4_fail1', 5*60, pc.get_map_index())
    notice_multiline(gameforge.deviltower_zone._50_dNotice,d.notice)

end

有几个地方可以使用“本地位置属性”右侧的“位置”表。Lua总是在计算左手边之前完全计算右手边,因此在本文中,位置指的是一个全局变量

第一次出现:在行中:

local positions,j,t = {{368, 629}, {419, 630}, {428, 653}, {422, 679}, {395, 689}, {369, 679}, {361, 658},},number(i,7), positions[i];
你可能是说:

local positions = {{368, 629}, {419, 630}, {428, 653}, {422, 679}, {395, 689}, {369, 679}, {361, 658},}
local j, t = number(i,7), positions[i]
虽然这不会100%起作用,因为我还不存在,但最好不要使用t变量

在这方面:

local positions,vid = deviltower_zone.get_4floor_stone_pos(), d.spawn_mob(8017, positions[7][1], positions[7][2])
你可能想做一些事情,比如:

local positions = deviltower_zone.get_4floor_stone_pos()
local vid = d.spawn_mob(8017, positions[7][1], positions[7][2])

这与问题没有直接关系,但您不需要像在Lua中那样交换变量。你可以做位置[i],位置[j]=位置[j],位置[i]。这是因为Lua计算右侧,将两个值推送到Lua堆栈,然后将两个值都属性化到左侧。