MathModule V3 -- make math easier(NEW CLASS TYPES)

ok im not gonna add it then

1 Like

Or you could just make a function to return a table with the 4 functions in use.
Like math.average = {mean = math.mean, median = math.median, ...}

1 Like

that would make the system tedious
it’s better to have them separate

V2 is now out, and make sure to tell me if any bugs are current in V2

should I make a tutorial on the module for V3, im going to be having class types so it might be helpful
  • yes
  • no
  • what is a tutorial?

0 voters

thanks for voting if you did, doryu

Not that you copied or anything, but I made a module to make it easier for myself around a month ago. Hit me up and we can collaborate and I can show you some of my functions, some include things such as finding composite and prime numbers, finding factors of a number, finding probability, and more. Discord: EternalEthel#3567

1 Like

I didn’t even assume that at all
anyways sure we can talk on discord about it

should I publish V3 now or make the tutorial first and post both at the same time
  • publish then make tutorial after
  • make tutorial and then publish

0 voters

making this because I finished making V3
just making sure since the tutorial won’t be finished for a while

here is the tutorial for V3
V3 is out!
make sure to tell me if you have any problems with the module at all :smiley:

1 Like

Instead of calling functions to return simple numbers (like euler’s number, golden ratio, etc) you should store these in your modules table.

Like so:

local myModule = {}
myModule.GoldenRatio = 1.6180339887499

-- do stuff

return myModule

As well as this, the module itself is incredibly hard to read.

(Also I noticed in your tutorial that you were defining the math global as your module, which is a bad idea)


this ignores the class properties
also you can easily change the math variable it’s not hard at all

Do you mind elaborating, I haven’t quite read through your documentation as it is hard to read.

I know but it encourages smaller and less experienced developers to follow suit.

1 Like

I don’t have a hard time reading it
I literally shows each class and each function
in the beginning of each script it shows what the class does

if you are going to say it’s hard to understand then tell me ways to improve it

it doesn’t mess up the math functions at all though
I don’t see a problem

which one sounds better?
  • V4 shouldn’t add too many more functions but should make the code way more readable(wouldn’t take as long)
  • V4 should add a lot more functions and make it more readable(would take longer)

0 voters

1 Like

V4 is finished(in studio, not uploaded), I ended up completely reworking everything in the module to make it super clean
I also took the existing code and made it even shorter
V4 is not out yet and I will be making an updated tutorial
btw I decided to not add any extra functions into the module, all I did was improve the already existing code and made it way more readable.

I will post V4 when I finish the tutorial and things irl, thank you for reading and waiting

1 Like

I am getting back from vacation July 4th, however V4 will not be worked on because I’m going to try and get a huge update done for a game I’m working on

also both CrazTrail and MathModule will be given a new post and a new name when they get to their next version which will be worked on after that huge update

EDIT: fixed the hyperlinks

It does not ignore the ‘class properties’.

Inside of the table being returned in the module, you have various tables which contain functions. It would be a good thing to simply store the numbers as ‘properties’ in the Value table, it does not make things more confusing given the users of the module look at the documentation properly.

Furthermore, there is a problem with some of the Value functions, and that would be that you are calculating a constant value inside some of the methods upon each invocation of the method. This is unnecessary, and if you really insist upon not having number properties inside of the Value table then you should at least store the numbers as constants and return them in the appropriate Value method.

Also, I would suggest splitting up the different tables (i.e. Chance, Check, etc.) into different modules for the sake of organisation, and then you could return a table containing the required modules in MathModule.

Finally, and this is mostly just nit-picking, I would advise spacing out your code to make it more readable. If someone wants to modify the module for personal use then that would be hard to with the current state of the module, since there is practically no spacing between each function.

yea I realize that now

thanks for the advice

yea I already did a lot of organizing with the module, only thing I didn’t do yet was space out the code in the modules

either way I’ll have to work on this after my game update so there won’t be updates on the module any time soon

I’ve been looking around for Jaro Similarity algorithms and happened to stumble upon your implementation within the math lib. Now, although it does achieve the goal, I found quite a few issues - mostly pertaining to code coherence and readability, as well as the usage of while loops within the algorithm which makes it a bit harder to benchmark.

Shortly said, I decided to re-create the implementation and after a few hours of transpilation and help from my colleagues I came up with this: GitHub - KhanPython/Jaro-Similarity: LuaU Jaro Similarity and Jaro Winkler Implementation

Feel free to use! (Perhaps an addition for your V4) :slight_smile:

1 Like