mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
@@ -15,7 +15,8 @@ local glm = require 'glm'
|
|||||||
---@field [string] any
|
---@field [string] any
|
||||||
|
|
||||||
---@type table<number, CZone>
|
---@type table<number, CZone>
|
||||||
Zones = {}
|
local Zones = {}
|
||||||
|
_ENV.Zones = Zones
|
||||||
|
|
||||||
local function nextFreePoint(points, b, len)
|
local function nextFreePoint(points, b, len)
|
||||||
for i = 1, len do
|
for i = 1, len do
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
local glm = require 'glm'
|
local glm = require 'glm'
|
||||||
|
|
||||||
---@type table<number, CZone>
|
---@type table<number, CZone>
|
||||||
Zones = {}
|
local Zones = {}
|
||||||
|
_ENV.Zones = Zones
|
||||||
|
|
||||||
local function removeZone(self)
|
local function removeZone(self)
|
||||||
Zones[self.id] = nil
|
Zones[self.id] = nil
|
||||||
|
|||||||
8
init.lua
8
init.lua
@@ -84,7 +84,7 @@ local function call(self, index, ...)
|
|||||||
return module
|
return module
|
||||||
end
|
end
|
||||||
|
|
||||||
lib = setmetatable({
|
local lib = setmetatable({
|
||||||
name = ox_lib,
|
name = ox_lib,
|
||||||
context = context,
|
context = context,
|
||||||
onCache = function(key, cb)
|
onCache = function(key, cb)
|
||||||
@@ -95,6 +95,8 @@ lib = setmetatable({
|
|||||||
__call = call,
|
__call = call,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
_ENV.lib = lib
|
||||||
|
|
||||||
-- Override standard Lua require with our own.
|
-- Override standard Lua require with our own.
|
||||||
require = lib.require
|
require = lib.require
|
||||||
|
|
||||||
@@ -167,7 +169,7 @@ end
|
|||||||
---Caches the result of a function, optionally clearing it after timeout ms.
|
---Caches the result of a function, optionally clearing it after timeout ms.
|
||||||
function cache(key, func, timeout) end
|
function cache(key, func, timeout) end
|
||||||
|
|
||||||
cache = setmetatable({ game = GetGameName(), resource = resourceName }, {
|
local cache = setmetatable({ game = GetGameName(), resource = resourceName }, {
|
||||||
__index = context == 'client' and function(self, key)
|
__index = context == 'client' and function(self, key)
|
||||||
AddEventHandler(('ox_lib:cache:%s'):format(key), function(value)
|
AddEventHandler(('ox_lib:cache:%s'):format(key), function(value)
|
||||||
self[key] = value
|
self[key] = value
|
||||||
@@ -191,6 +193,8 @@ cache = setmetatable({ game = GetGameName(), resource = resourceName }, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
_ENV.cache = cache
|
||||||
|
|
||||||
local notifyEvent = ('__ox_notify_%s'):format(cache.resource)
|
local notifyEvent = ('__ox_notify_%s'):format(cache.resource)
|
||||||
|
|
||||||
if context == 'client' then
|
if context == 'client' then
|
||||||
|
|||||||
Reference in New Issue
Block a user