I've been recently studying the assets and I came upon the util.lua file that alot of other scripts reference from. I opened it and I'm somewhat lost on what this file is supposed to do. Can someone enlighten me? Thanks in advance.
Well, I'm still new to LUA (though not to programming); but from what I can tell, it's just a set of somewhat-random functions for different scripts to use. It is very common for coders to make files containing a bunch of related functions, so that they can easily include those in other files (that actually do something) rather than having to retype the functions every time they need them. For example, look at the file "/scripts/actions/merchant.lua". It includes the "util.lua" script at the start, then--on line 83--it calls one of the functions from that script: "util.randomInRange". So, I would say, the only things the "util.lua" script actually does are: Creates several objects: "util" (line 1), "Profiler" (line 948), etc. Defines a bunch of functions: some for the objects (i.e. "util.randomRange"), some globally (i.e. "copy").
"util.lua" is mostly referenced to "/scripts/util.lua" in the assets and has all the necessary function to write your scripts. Devs uses this for their commonly used functions. I'd suggest to write your own "util.lua" since their "util.lua" can probably change. Inside of "util.lua" contains a lot of simple functions that are relatively easy to understand (if you know how Lua works) Some are documented with some comments.