58 Commits
Author SHA1 Message Date
ESK0 8d1677f397 fix(interval): Check if interval was cleared before invoking callback (#745) 2025-04-10 15:44:12 -07:00
Linden cc6aed591f chore: adjust links 2025-03-29 21:46:58 +11:00
Linden fb2225e373 chore: add copyright notices to each file
Some people accidentally, mistakenly, and without any malicious intent forget to attribute code from this resource to its source. This change will hopefully assist people, so that they do not make that mistake again.
2025-03-18 18:46:09 +11:00
Linden 6fcb83101f refactor(init): attempt to catch module errors from invalid installs
Since people continue to drag and drop updates
without clearing old files, then spend days or weeks
complaining about script errors.
2025-03-18 02:29:31 +11:00
Linden 4596e4319c refactor(init): move global declarations 2024-10-14 17:36:24 +11:00
Linden 6b12831817 feat(cache): send oldValue to onCache
Internally handle the cache events to prevent race conditions
and resolve #618.
Improved types.
2024-08-13 14:11:27 +10:00
Linden 45b9560a44 fix(init/cache): allow setting false cached value
Resolves #605.
2024-07-01 12:17:50 +10:00
Linden 3e66dccb4b fix(init): prevent loading multiple instances of ox_lib
Resolves #545.
2024-04-11 15:03:41 +10:00
Linden aebe248e39 refactor: localise globals to prevent shadowing
See #456.
2023-12-07 08:36:40 +11:00
AndyandLinden 62ff7345b9 feat(imports): server-side entity iterators (#458)
Co-authored-by: Linden <65407488+thelindat@users.noreply.github.com>
2023-12-07 08:25:31 +11:00
Linden 3e527ac517 refactor(init): disallow loading ox_lib's import IN ox_lib
Seriously, why?
2023-08-20 10:37:45 +10:00
Linden d1b8d0ec6c fix(init): set correct chunk name
Used in debugging and errors.
2023-08-13 09:22:37 +10:00
Linden 9df29d9d3a fix(init): check if ox_lib is started 2023-08-13 08:57:02 +10:00
Linden b014e43e14 feat(init): importing modules with resource metadata
Allow loading modules through fxmanifest (i.e. ox_lib 'locale' or ox_libs { 'locale' }).
Useful in some cases where the module needs to be loaded (lib.locale()) first.
2023-08-02 16:16:37 +10:00
Linden b68da917be feat(init): cache.__call metamethod for caching function results
See #385.
Included formatting changes (tabs->spaces).
2023-08-02 15:17:14 +10:00
Linden 9d98b9aada chore: types
mostly types anyway.
2023-07-31 16:29:27 +10:00
Linden 89b9016586 fix(init): enable ignore_invalid for msgpack
Needed to prevent errors when packing glm polygons and such.
2023-07-26 12:47:07 +10:00
Linden 639faa214d refactor(init): minor tweaks
Remove dead table (lib.exports) and annotate server-side lib.notify.
2023-02-22 10:08:43 +11:00
Linden 7ab2aac9be feat(imports/require): custom require for script files 2023-02-22 09:53:58 +11:00
Luke b56e6826a8 Merge branch 'v3' 2023-02-17 15:54:20 +01:00
Linden 1565187860 refactor(init): change notify netevent name
Other name was too generic and may conflict with user-code.
2023-02-03 13:04:48 +11:00
Linden 74628a5167 refactor: remove deprecated code
getCore and player modules were deprecated long ago and only used once.
2023-01-25 15:39:35 +11:00
Scully 231d1c3c77 feat: improved RedM support (#162)
* Improvements + remove redm keybind system as it's pointless
2022-11-26 13:05:55 +11:00
Linden e840bbb50f refactor(init): report ox_lib error when loading imports
People like to cry about resources not working because they
failed to install ox_lib and don't know how to read, missing the
fat error and stack trace on resource start.

Now we can remind these people they need to actually install
a release.
2022-10-28 18:46:56 +11:00
Linden 79dd3f5934 fix: no-op 2022-10-10 16:56:05 +11:00
Linden 21214728b7 refactor(init): module stub
If module doesn't return a result, create a stub function.
2022-09-18 22:42:05 +10:00
Linden 32e2da2d8f refactor(init): type-fixes and minor adjustments 2022-09-14 01:42:14 +10:00
Linden 7838a3cfe4 refactor(init): cache handling
lib.onCache serves as a helper to setup cache event listeners.
Removed _cache table and index method.
Only apply metatable to client-side cache (nothing exists on server yet).
When cache is indexed, setup an event handler for the key.
Remove some ox_core/ox_groups specific code (unused).
Remove the updateCache event, and interval.
2022-07-28 23:13:19 +10:00
Linden 770ae6396e relicense to LGPLv3
Allows resources importing ox_lib to ignore the "same license" condition.
Does not apply to snippets copied from ox_lib into other resources.
2022-07-05 05:17:52 +10:00
Linden 130ea5d17e refactor(init): lib.notify server function
Client handler attempts to translate the notification if locales are loaded.
2022-06-19 13:36:11 +10:00
Linden 3bb946001b refactor(init): separate global and local cache
Store temporary data in the _cache local, separate from the global cache.

This allows constants and other values to be added, rather than being
wiped every minute.
2022-05-25 13:28:19 +10:00
Linden 139ae0701b refactor(getCore/client): clean up hasGroup method and return values 2022-05-12 07:44:29 +10:00
Linden ef4ca56889 refactor(init): return a stub for imports with no return
Modules that define globals or directly add several functions to the
lib namespace currently need to return empty functions (i.e. locales).
2022-05-12 00:02:25 +10:00
Linden 8bcae1937b tweak(init): store service and name in lib
lib.name for 'ox_lib', and service or 'client' or 'server'.
2022-05-01 22:47:34 +10:00
Linden f6216af1ae refactor: rename lualib variable and move clipboard export 2022-04-29 03:02:06 +10:00
Linden 1ac844f20a tweak(init): store serverId 2022-04-11 04:59:01 +00:00
Linden 62e4fea5ad refactor(init): set cache[key] after triggering onCache
Allow for comparison of new and old values by checking cache[key]
against the value sent as an argument.
2022-03-15 10:34:22 +00:00
Linden 13c8c29811 refactor: change event names from lualib to ox_lib 2022-03-13 03:21:01 +00:00
Linden 3c7cd3dc6b refactor(init): throw an error if ox_lib is not started 2022-03-10 15:54:13 +11:00
Linden 6b8b7990c8 fix(init): incorrect server check 2022-03-01 14:20:14 +00:00
Linden 5a30dd7ad1 fix(init): initial cache index returns full table 2022-03-01 13:58:08 +00:00
Linden a37a897b10 feat(init): callback hook when updating cache 2022-03-01 13:42:39 +00:00
Linden 58faab6217 feat(init): implement cache 2022-03-01 13:23:47 +00:00
Linden aeccbece09 refactor: rename imports
BREAKING!
Since the folder name determines the import name (i.e. lib.callbacks), use better names and lowerCamelCase.
2022-02-28 16:30:58 +11:00
Linden e83aa653cc refactor(init): call imports and exports via lib
Deprecate import (now just references lib); when calling or indexing
lib for the first time, attempt to load a module else call an export.
2022-02-28 02:40:25 +00:00
Linden d3ef7d5018 refactor: rename resource 2022-02-28 00:48:36 +00:00
Linden 40b7fe2a77 refactor(init): don't cache function refs 2022-02-28 08:35:32 +11:00
Linden d0c5f722db refactor(init): export cache and update intervals
BREAKING CHANGE: lib will store cached export functions and no longer uses the : syntax to call functions.

Allow SetInterval to return arguments to the callback function.
2021-12-27 12:19:37 +11:00
Linden ec1a98b83a feat(keys): implement a DisableControlAction wrapper 2021-12-06 09:54:45 +11:00
Linden d25cac3be4 Revert "feat(init): add custom packing for metatables"
This reverts commit 1ad137b8c5.

Prefer native solutions, this is too niche.
2021-12-05 04:58:48 +11:00