Repository navigation
Library: Math
ᴏᴠ ━ ᴀɴɪꜱᴀ edited this page Dec 5, 2024
·
21 revisions
While Lua provides a standard math module, it lacks certain advanced mathematical utilities and classes often required in complex applications. This library extends Lua's mathematical capabilities by introducing additional functionality.
It's already imported by default whenever you import assetify. You need to declare the below globally only once:
loadstring(exports.assetify_library:import())()ℹ️ Our extensions are designed with backward compatibility in mind; your existing code is expected to function as intended. Nonetheless, we recommend transitioning to newer syntax.
local float: result = math.round(
float: value,
int: decimals --(Optional) By default its 0 if left unspecified
)local float: result = math.percent(
float: value,
float: percent
)local float: result = math.findDistance2D(
float: x1,
float: y1,
float: x2,
float: y2
)local float: result = math.findDistance3D(
float: x1,
float: y1,
float: z1
float: x2,
float: y2,
float: z2
)local float: result = math.findRotation2D(
float: x1,
float: y1,
float: x2,
float: y2
)@Objective: Generates new coords of an existing 2D-Point after rotating it by specified distance & rotation angle.
local float: result = math.findPointByRotation2D(
float: x,
float: y,
float: distance,
float: rotation
)