Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a8ea6429e1 |
@@ -0,0 +1,42 @@
|
|||||||
|
-- Lua50Compat.lua
|
||||||
|
-- Loaded FIRST (see VanillaGuide.toc) to restore Lua 5.0 table functions that
|
||||||
|
-- the WoW 3.3.5 / Project Ascension Lua 5.1 runtime has made obsolete.
|
||||||
|
--
|
||||||
|
-- table.setn existed in 5.0 to manually hint the array length; in 5.1 the
|
||||||
|
-- length operator (#) is authoritative and table.setn is a stub that raises
|
||||||
|
-- "attempt to call a nil value" or "'setn' is obsolete". Overwrite it with a
|
||||||
|
-- no-op unconditionally so Ace2 libs (AceOO, AceEvent, AceConsole, AceDebug,
|
||||||
|
-- AceLibrary, AceDB, Tablet-2.0) can assign the local alias at module load
|
||||||
|
-- time without erroring.
|
||||||
|
--
|
||||||
|
-- table.getn existed in 5.0 as the canonical length function; in 5.1 it was
|
||||||
|
-- removed (or kept as an error stub on some runtimes). Replace it with the
|
||||||
|
-- equivalent # operator.
|
||||||
|
--
|
||||||
|
-- table.foreach / table.foreachi were removed in 5.1 as well; guard them in
|
||||||
|
-- case any lib uses them (none currently do, but safe to shim anyway).
|
||||||
|
|
||||||
|
-- Unconditional overwrite -- even if these slots exist they may raise.
|
||||||
|
table.setn = function() end
|
||||||
|
|
||||||
|
table.getn = function(t)
|
||||||
|
return #t
|
||||||
|
end
|
||||||
|
|
||||||
|
if not table.foreach then
|
||||||
|
table.foreach = function(t, f)
|
||||||
|
for k, v in pairs(t) do
|
||||||
|
local ret = f(k, v)
|
||||||
|
if ret then return ret end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not table.foreachi then
|
||||||
|
table.foreachi = function(t, f)
|
||||||
|
for i = 1, #t do
|
||||||
|
local ret = f(i, t[i])
|
||||||
|
if ret then return ret end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
## SavedVariables: VanillaGuideDB
|
## SavedVariables: VanillaGuideDB
|
||||||
## SavedVariablesPerCharacter: VanillaGuideDBPC
|
## SavedVariablesPerCharacter: VanillaGuideDBPC
|
||||||
|
|
||||||
|
Lua50Compat.lua
|
||||||
libs\AceLibrary\AceLibrary.lua
|
libs\AceLibrary\AceLibrary.lua
|
||||||
libs\AceOO-2.0\AceOO-2.0.lua
|
libs\AceOO-2.0\AceOO-2.0.lua
|
||||||
libs\AceConsole-2.0\AceConsole-2.0.lua
|
libs\AceConsole-2.0\AceConsole-2.0.lua
|
||||||
|
|||||||
Reference in New Issue
Block a user