diff --git "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/Lua-\345\257\274\345\205\245\345\244\226\351\203\250\350\204\232\346\234\254.w3x" "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/Lua-\345\257\274\345\205\245\345\244\226\351\203\250\350\204\232\346\234\254.w3x" index e617077be..18096786c 100644 Binary files "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/Lua-\345\257\274\345\205\245\345\244\226\351\203\250\350\204\232\346\234\254.w3x" and "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/Lua-\345\257\274\345\205\245\345\244\226\351\203\250\350\204\232\346\234\254.w3x" differ diff --git "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/Lua-\350\256\241\346\227\266\345\231\250-\345\234\243\345\205\211.w3x" "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/Lua-\350\256\241\346\227\266\345\231\250-\345\234\243\345\205\211.w3x" index dd8d6ec71..a01e1ab80 100644 Binary files "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/Lua-\350\256\241\346\227\266\345\231\250-\345\234\243\345\205\211.w3x" and "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/Lua-\350\256\241\346\227\266\345\231\250-\345\234\243\345\205\211.w3x" differ diff --git "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/blizzard.lua" "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/blizzard.lua" index 9659f9ffe..e84df558b 100644 --- "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/blizzard.lua" +++ "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/blizzard.lua" @@ -1,6 +1,6 @@ -- ���׵�blizzard.lua������Ҫ������blizzard.lua������ʹ��jass2lua���ߣ�����ת���� -local CJ = jass +local CJ = require "jass.common" local BJ = {} BJ.bj_MAX_PLAYER_SLOTS = 16 diff --git "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/main.lua" "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/main.lua" index 6282add15..9054fc239 100644 --- "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/main.lua" +++ "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/main.lua" @@ -1,4 +1,4 @@ -local CJ = jass +local CJ = require "jass.common" local BJ = require "blizzard.lua" local trig = CJ.CreateTrigger() diff --git "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/runtime_init.lua" "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/runtime_init.lua" index cce7067fd..cfcb2300d 100644 --- "a/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/runtime_init.lua" +++ "b/Development/Editor/Component/example(\346\274\224\347\244\272\345\234\260\345\233\276)/JAPI/lua/runtime_init.lua" @@ -1,11 +1,13 @@ +local runtime = require "jass.runtime" + -- 开启一个调试窗口,用于显示调试信息,正式的版本请去掉。 -- 注:若在本文件内有语法错误,这行代码就不会被执行,语法错误也无法显示。所以 -- 需要在一切都开始前,执行它;并确保本文件内没有错误。 -jass_ext.runtime.console = true +runtime.console = true -- 注册错误回调函数,当执行lua发生错误时,会调用此函数。 -- 注:注册此函数会略微增加运行时消耗(即使没有发生错误)。 -function jass_ext.runtime.error_handle(msg) +function runtime.error_handle(msg) print("---------------------------------------") print(" LUA ERROR ") print("---------------------------------------") @@ -15,7 +17,7 @@ function jass_ext.runtime.error_handle(msg) end -- --- 设定调用cj函数返回的handle的type。(默认值为1) +-- 设定调用cj函数返回的handle的type。(默认值为2) -- 安全性依次递增,同时效率也会依次下降。 -- 0: 返回number。 ---- 没有任何额外的安全性控制。 @@ -28,9 +30,15 @@ end ---- lua持有handle时会增加handle的引用计数,并在__gc元方法中释放handle。 ---- 0不再能被隐式转换为nil,对应jass里的null请使用nil。 -- -jass_ext.runtime.handle_level = 1 +runtime.handle_level = 2 -- 开启此项(默认开启),调用jass.xxx/japi.xxx发生崩溃时,会生产一个lua错误,并忽略这个崩溃。 -- 你可以注册jass_ext.runtime.error_handle,来获得这个错误。 -- 注:开启此项会略微增加运行时消耗(即使没有发生错误)。 -jass_ext.runtime.catch_crash = true +runtime.catch_crash = true + +-- 此项默认为开启。common.j中包含sleep操作的函数有4个,TriggerSleepAction/TriggerSyncReady +-- /TriggerWaitForSound/SyncSelections。当此项为false时,lua引擎会忽略这4个函数的调用,并给 +-- 予运行时警告。当此项为true时,这4个函数将会得到正确的执行。 +-- 注:开启此项会增加运行时消耗,即使你没有使用这4个函数。 +runtime.sleep = true diff --git a/Development/Editor/Component/plugin/YDTrigger/YDTrigger.h b/Development/Editor/Component/plugin/YDTrigger/YDTrigger.h index b9446cb36..06f81d659 100644 --- a/Development/Editor/Component/plugin/YDTrigger/YDTrigger.h +++ b/Development/Editor/Component/plugin/YDTrigger/YDTrigger.h @@ -41,13 +41,13 @@ # include # define YDWEGetObjectProperty(object_type, object_id, property) \ YDTRIGGER_COMMON_SWITCH(YDWE_GET_OBJECT_PROPERTY_ ## object_type, ( \ - EXExecuteScript("slk.ability[" + I2S(object_id) + "]." + property), \ - EXExecuteScript("slk.buff[" + I2S(object_id) + "]." + property), \ - EXExecuteScript("slk.unit[" + I2S(object_id) + "]." + property), \ - EXExecuteScript("slk.item[" + I2S(object_id) + "]." + property), \ - EXExecuteScript("slk.upgrade[" + I2S(object_id) + "]." + property), \ - EXExecuteScript("slk.doodad[" + I2S(object_id) + "]." + property), \ - EXExecuteScript("slk.destructable[" + I2S(object_id) + "]." + property), \ + EXExecuteScript("(require'jass.slk').ability[" + I2S(object_id) + "]." + property), \ + EXExecuteScript("(require'jass.slk').buff[" + I2S(object_id) + "]." + property), \ + EXExecuteScript("(require'jass.slk').unit[" + I2S(object_id) + "]." + property), \ + EXExecuteScript("(require'jass.slk').item[" + I2S(object_id) + "]." + property), \ + EXExecuteScript("(require'jass.slk').upgrade[" + I2S(object_id) + "]." + property), \ + EXExecuteScript("(require'jass.slk').doodad[" + I2S(object_id) + "]." + property), \ + EXExecuteScript("(require'jass.slk').destructable[" + I2S(object_id) + "]." + property), \ )) # define YDWEGetObjectPropertyInteger(type, id, prop) S2I(YDWEGetObjectProperty(type, id, prop)) # define YDWEGetObjectPropertyReal(type, id, prop) S2R(YDWEGetObjectProperty(type, id, prop))