whitespace fixes

This commit is contained in:
Celtic Minstrel 2021-05-11 00:21:48 -04:00
parent 574bc1a36e
commit 0970880910
9 changed files with 20 additions and 20 deletions

View File

@ -56,4 +56,4 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
-- No deprecation for these since since they're not actually public API yet
wesnoth.set_menu_item = wesnoth.interface.set_menu_item
wesnoth.clear_menu_item = wesnoth.interface.clear_menu_item
end
end

View File

@ -95,4 +95,4 @@ function mathx.shuffle(t, random_func)
end
end
mathx.random = wesnoth.deprecate_api('mathx.random', 'mathx.random', 1, nil, mathx.random)
mathx.random = wesnoth.deprecate_api('mathx.random', 'mathx.random', 1, nil, mathx.random)

View File

@ -45,4 +45,4 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.get_sides = wesnoth.deprecate_api('wesnoth.get_sides', 'wesnoth.sides.find', 1, nil, wesnoth.sides.find)
wesnoth.create_side = wesnoth.deprecate_api('wesnoth.create_side', 'wesnoth.sides.create', 1, nil, wesnoth.sides.create)
wesnoth.modify_ai = wesnoth.deprecate_api('wesnoth.modify_ai', 'wesnoth.sides.add|delete|change_ai_component', 1, nil, wesnoth.modify_ai)
end
end

View File

@ -366,7 +366,7 @@ if wesnoth.kernel_type() ~= "Application Lua Kernel" then
wml.array_access.set(key, value)
end
})
--[========[Global persistent variables]========]
local ns_key, global_temp = '$ns$', "lua_global_variable"
local global_vars_ns = {}
@ -375,7 +375,7 @@ if wesnoth.kernel_type() ~= "Application Lua Kernel" then
setmetatable({[ns_key] = namespace}, global_vars_ns)
end
}
function global_vars_ns.__index(self, name)
local U = wesnoth.require "wml-utils"
local var <close> = U.scoped_var(global_temp)
@ -393,7 +393,7 @@ if wesnoth.kernel_type() ~= "Application Lua Kernel" then
end
return res
end
function global_vars_ns.__newindex(self, name, val)
local U = wesnoth.require "wml-utils"
local var <close> = U.scoped_var(global_temp)
@ -407,12 +407,12 @@ if wesnoth.kernel_type() ~= "Application Lua Kernel" then
}
end)
end
-- Make sure wesnoth.experimental.wml actually exists
-- It's done this way so it doesn't break if we later need to add things here from C++
wesnoth.experimental = wesnoth.experimental or {}
wesnoth.experimental.wml = wesnoth.experimental.wml or {}
wesnoth.experimental.wml.global_vars = setmetatable({}, global_vars_mt)
else
--[========[Backwards compatibility for wml.tovconfig]========]

View File

@ -1248,7 +1248,7 @@ int game_lua_kernel::impl_scenario_get(lua_State *L)
lua_push(L, mods);
return 1;
}
if(classification.is_multiplayer()) {
return_cfgref_attrib("mp_settings", play_controller_.get_mp_settings().to_config());
return_cfgref_attrib("era", find_addon("era", classification.era_id));
@ -4387,7 +4387,7 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports
lua_setmetatable(L, -2);
lua_setfield(L, -2, "game_display");
lua_pop(L, 1);
// Create the scenario table.
cmd_log_ << "Adding scenario table...\n";

View File

@ -394,7 +394,7 @@ static int impl_source_get(lua_State* L) {
return_bool_attrib("check_fogged", src->check_fogged());
return_bool_attrib("check_shrouded", src->check_shrouded());
return_cfg_attrib("__cfg", src->write(cfg));
if(strcmp(m, "locations") == 0) {
const auto& locs = src->get_locations();
lua_createtable(L, locs.size(), 0);
@ -417,7 +417,7 @@ static int impl_source_set(lua_State* L) {
modify_int_attrib("fade_range", src->set_fade_range(value));
modify_bool_attrib("check_fogged", src->set_check_fogged(value));
modify_bool_attrib("check_shrouded", src->set_check_shrouded(value));
if(strcmp(m, "sounds") == 0) {
std::string files;
if(lua_istable(L, 3)) {
@ -427,12 +427,12 @@ static int impl_source_set(lua_State* L) {
}
src->set_files(files);
}
if(strcmp(m, "locations") == 0) {
std::vector<map_location> locs;
locs.resize(1);
if(luaW_tolocation(L, 3, locs[0])) {
} else {
locs.clear();
for(lua_pushnil(L); lua_next(L, 3); lua_pop(L, 1)) {
@ -441,7 +441,7 @@ static int impl_source_set(lua_State* L) {
}
src->set_locations(locs);
}
// Now apply the change
resources::soundsources->add(*src);
resources::soundsources->update();
@ -516,7 +516,7 @@ namespace lua_audio {
};
luaL_setfuncs(L, vol_callbacks, 0);
lua_setmetatable(L, -2);
// The music playlist metatable
lua_newuserdatauv(L, 0, 0);
lua_createtable(L, 0, 10);
@ -537,7 +537,7 @@ namespace lua_audio {
lua_setfield(L, -2, "__metatable");
lua_setmetatable(L, -2);
lua_setfield(L, -2, "music_list");
// The sound source map metatable
lua_newuserdatauv(L, 0, 0);
lua_createtable(L, 0, 3);

View File

@ -389,7 +389,7 @@ namespace lua_units {
lua_setfield(L, -2, "__metatable");
lua_pushcfunction(L, impl_unit_attack_match);
lua_setfield(L, -2, "matches");
return cmd_out.str();
}
}

View File

@ -248,7 +248,7 @@ mapgen_lua_kernel::mapgen_lua_kernel(const config* vars)
luaL_setfuncs(L, map_callbacks, 0);
lua_pop(L, 1);
assert(lua_gettop(L) == 0);
// Add functions to the WML module
lua_getglobal(L, "wml");
static luaL_Reg const wml_callbacks[] {

View File

@ -204,7 +204,7 @@ public:
const std::string& id() const { return id_; }
const std::string& files() const { return files_; }
void set_files(const std::string& f) {
files_ = f;
}