1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-07-04 00:51:21 +02:00

luacheck, remove old compatibility stuff

This commit is contained in:
Niklp09
2023-06-11 20:13:08 +02:00
parent 72a9d1bb7d
commit 1f31515cdd
17 changed files with 71 additions and 96 deletions

View File

@ -18,7 +18,7 @@
-- Deprecation
function deprecated_global_table(deprecated_global_name, replacement_global_name)
local function deprecated_global_table(deprecated_global_name, replacement_global_name)
assert(type(deprecated_global_name) == 'string', "deprecated_global_name should be a string.")
assert(type(replacement_global_name) == 'string', "replacement_global_name should be a string.")
assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.")

View File

@ -19,6 +19,7 @@
-- This is the unicode char fallback map. If a char is not present in
-- font, this maps indicates which char to try to use instead next.
-- luacheck: ignore
return {
-- Lowercase chars
['a'] = 'A', ['b'] = 'B', ['c'] = 'C', ['d'] = 'D',

View File

@ -212,7 +212,7 @@ end
-- @return Texture string
function Font:render(text, texturew, textureh, style)
local style = style or {}
style = style or {}
-- Split text into lines (and limit to style.lines # of lines)
local lines = {}
@ -243,17 +243,17 @@ function Font:render(text, texturew, textureh, style)
y = y + (self.margintop or 0)
for _, line in pairs(lines) do
for _, l in pairs(lines) do
if style.halign == "left" then
x = 0
elseif style.halign == "right" then
x = texturew - line.width
x = texturew - l.width
else
x = (texturew - line.width) / 2
x = (texturew - l.width) / 2
end
while line.text ~= '' do
codepoint, line.text = self:get_next_char(line.text)
while l.text ~= '' do
codepoint, l.text = self:get_next_char(l.text)
if codepoint == nil then return '' end -- UTF Error
-- Add image only if it is visible (at least partly)

View File

@ -60,6 +60,7 @@ local function get_default_font()
-- If failed, chose first font
if default_font == nil then
-- luacheck: ignore 512
for _, font in pairs(font_api.registered_fonts) do
default_font = font
break