From d141ef1eb13f901a6a70afc9d9557ba7106bf734 Mon Sep 17 00:00:00 2001 From: CiscOH Bellic Date: Sat, 27 Jul 2024 13:29:19 -0400 Subject: [PATCH] "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." --- scripts/Locales/enUS.lua | 2 ++ src/Item/Item.lua | 8 +++++--- src/Locale/Locale.lua | 5 +++-- src/_bastion.lua | 7 ++++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/scripts/Locales/enUS.lua b/scripts/Locales/enUS.lua index 2a61ba0..e372ce4 100644 --- a/scripts/Locales/enUS.lua +++ b/scripts/Locales/enUS.lua @@ -8,3 +8,5 @@ L["Tinkr"] = "Tinkr" L["Bastion"] = "Bastion" Bastion.Locale.SetTable(L) + +return L \ No newline at end of file diff --git a/src/Item/Item.lua b/src/Item/Item.lua index b8b85d0..3ae0354 100644 --- a/src/Item/Item.lua +++ b/src/Item/Item.lua @@ -60,7 +60,7 @@ function Item:New(id) return self end -local GetItemInfo = Bastion.Environment:GetItemInfo(...) +local environment = Bastion.Environment -- Get the Items id ---@return number @@ -71,13 +71,15 @@ end -- Get the Items name ---@return string function Item:GetName() - return GetItemInfo(self:GetID()) + return environment:GetItemInfo(self:GetID()) +-- return GetItemInfo(self:GetID()) end -- Get the Items icon ---@return number function Item:GetIcon() - return select(3, GetItemInfo(self:GetID())) + return select(3, environment:GetItemInfo(self:GetID())) + -- return select(3, GetItemInfo(self:GetID())) end -- Get the Items cooldown diff --git a/src/Locale/Locale.lua b/src/Locale/Locale.lua index c62c7d2..4cf0056 100644 --- a/src/Locale/Locale.lua +++ b/src/Locale/Locale.lua @@ -6,7 +6,7 @@ Locale.__index = Locale local private = { locale = nil, tbl = nil, - hasNoLocaleTable = nil + hasNoLocaleTable = false } private.locale = function() @@ -28,7 +28,6 @@ function Locale.ShouldLoad(locale) end function Locale.SetTable(tbl) - assert(not private.tbl) private.tbl = setmetatable(tbl, { __index = function(t, k) local v = tostring(k) @@ -44,6 +43,8 @@ function Locale.SetTable(tbl) }) end + + Locale.SetTable({}) return Locale diff --git a/src/_bastion.lua b/src/_bastion.lua index a1cb5c0..2ec49b4 100644 --- a/src/_bastion.lua +++ b/src/_bastion.lua @@ -7,7 +7,8 @@ local Bastion = { } Bastion.__index = Bastion - +Bastion._Unlocker = Tinkr +_G.Bastion = Bastion function Bastion:Require(file) -- If require starts with an @ then we require from the scripts/bastion/scripts folder @@ -61,6 +62,10 @@ Bastion.Globals = {} ---@type Locale Bastion.Locale = Bastion.require("Locale") Load("@Locales/") +Bastion.Locales = {} +Bastion.Locales.enUS = Bastion:Require("@Locales/enUS") +local L = Bastion.Locale.GetTable() +Bastion.Globals.L = L ---@type Environment Bastion.Environment = Bastion.require("Environment") ---@type ClassMagic