"Updated Lua code in various files: added return statement in enUS.lua, refactored Item.lua, modified Locale.lua, and updated _bastion.lua with new variables and require statements."

CiscOH Bellic 2 years ago
parent 60e644d6aa
commit d141ef1eb1
  1. 2
      scripts/Locales/enUS.lua
  2. 8
      src/Item/Item.lua
  3. 5
      src/Locale/Locale.lua
  4. 7
      src/_bastion.lua

@ -8,3 +8,5 @@ L["Tinkr"] = "Tinkr"
L["Bastion"] = "Bastion" L["Bastion"] = "Bastion"
Bastion.Locale.SetTable(L) Bastion.Locale.SetTable(L)
return L

@ -60,7 +60,7 @@ function Item:New(id)
return self return self
end end
local GetItemInfo = Bastion.Environment:GetItemInfo(...) local environment = Bastion.Environment
-- Get the Items id -- Get the Items id
---@return number ---@return number
@ -71,13 +71,15 @@ end
-- Get the Items name -- Get the Items name
---@return string ---@return string
function Item:GetName() function Item:GetName()
return GetItemInfo(self:GetID()) return environment:GetItemInfo(self:GetID())
-- return GetItemInfo(self:GetID())
end end
-- Get the Items icon -- Get the Items icon
---@return number ---@return number
function Item:GetIcon() function Item:GetIcon()
return select(3, GetItemInfo(self:GetID())) return select(3, environment:GetItemInfo(self:GetID()))
-- return select(3, GetItemInfo(self:GetID()))
end end
-- Get the Items cooldown -- Get the Items cooldown

@ -6,7 +6,7 @@ Locale.__index = Locale
local private = { local private = {
locale = nil, locale = nil,
tbl = nil, tbl = nil,
hasNoLocaleTable = nil hasNoLocaleTable = false
} }
private.locale = function() private.locale = function()
@ -28,7 +28,6 @@ function Locale.ShouldLoad(locale)
end end
function Locale.SetTable(tbl) function Locale.SetTable(tbl)
assert(not private.tbl)
private.tbl = setmetatable(tbl, { private.tbl = setmetatable(tbl, {
__index = function(t, k) __index = function(t, k)
local v = tostring(k) local v = tostring(k)
@ -44,6 +43,8 @@ function Locale.SetTable(tbl)
}) })
end end
Locale.SetTable({}) Locale.SetTable({})
return Locale return Locale

@ -7,7 +7,8 @@ local Bastion = {
} }
Bastion.__index = Bastion Bastion.__index = Bastion
Bastion._Unlocker = Tinkr
_G.Bastion = Bastion
function Bastion:Require(file) function Bastion:Require(file)
-- If require starts with an @ then we require from the scripts/bastion/scripts folder -- If require starts with an @ then we require from the scripts/bastion/scripts folder
@ -61,6 +62,10 @@ Bastion.Globals = {}
---@type Locale ---@type Locale
Bastion.Locale = Bastion.require("Locale") Bastion.Locale = Bastion.require("Locale")
Load("@Locales/") Load("@Locales/")
Bastion.Locales = {}
Bastion.Locales.enUS = Bastion:Require("@Locales/enUS")
local L = Bastion.Locale.GetTable()
Bastion.Globals.L = L
---@type Environment ---@type Environment
Bastion.Environment = Bastion.require("Environment") Bastion.Environment = Bastion.require("Environment")
---@type ClassMagic ---@type ClassMagic

Loading…
Cancel
Save