Lua code: replace deprecated wesnoth.get_all_vars() calls
This commit is contained in:
parent
51b2dbec19
commit
acf4269f6a
2 changed files with 4 additions and 3 deletions
|
@ -236,11 +236,12 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
|
|||
--[========[Basic variable access]========]
|
||||
|
||||
-- Get all variables via wml.all_variables (read-only)
|
||||
local get_all_vars_local = wesnoth.get_all_vars
|
||||
setmetatable(wml, {
|
||||
__metatable = "WML module",
|
||||
__index = function(self, key)
|
||||
if key == 'all_variables' then
|
||||
return wesnoth.get_all_vars()
|
||||
return get_all_vars_local()
|
||||
end
|
||||
return rawget(self, key)
|
||||
end,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[lua]
|
||||
code = << local a,b,c = false,false,false
|
||||
for k,v in pairs(wesnoth.get_all_vars()) do
|
||||
for k,v in pairs(wml.all_variables) do
|
||||
if k == "A" then
|
||||
a = true
|
||||
elseif (k == "B") and (v == 10) then
|
||||
|
@ -40,7 +40,7 @@
|
|||
|
||||
[lua]
|
||||
code = << local a,b,c = false,false,false
|
||||
for k,v in pairs(wesnoth.get_all_vars()) do
|
||||
for k,v in pairs(wml.all_variables) do
|
||||
if k == "A" then
|
||||
a = true
|
||||
elseif (k == "B") and (v == 10) then
|
||||
|
|
Loading…
Add table
Reference in a new issue