Custom libraries with global functions (script templates)

These are modules that you can require and replace with the global function together:

customLibraries.rbxm (3.7 KB)

It is some random code I made so it’s not substantial for the open source Community Resources category and you can edit it freely as I just put some functions in it, it’s not a full library so you may want to add your own, it is not much in there.

To use, just set your global function as the module required

local math = require(moduleReference)

You will be able to use the normal math global functions as well as your custom created ones. It will not show the custom created ones however so you will not know if you are indexing something that doesn’t exist during the coding. There is also a custom Enum module you can change freely.

This is more like a module scripts template for creating your custom global functions rather than an enriched library so I suggest you edit it yourself, I have already included some functions as well if you want to keep those.

Some are:
CFrame.LookAt(eye, target, normalId): The non-deprecated solution to CFrame.new(pos, lookAt) that fixes edge cases, different from the wiki’s used function. (Credit to EgoMoose for function)
table.copy(t): Copy a table recursively, metatables excluded
table.deepcopy(t): Copy a table, metatables included
string.iswhitespace(str): Check if a string is just pure whitespace characters
string.removebeginningwhitespaces(str): Remove whitespace characters from the beginning of a string if there are any

Example Code:

local string = require(stringModule)

print(string.iswhitespace("     ")) -- true
print(string.iswhitespace("notwhitespace")) -- false
print(string.removebeginningwhitespaces("    nonwhitespace  s")) -- "nonwhitespace  s"
4 Likes