probablytukars / LuaQuaternion

A fully featured library for utilizing quaternions in lua.
https://probablytukars.github.io/LuaQuaternion/
MIT License
14 stars 1 forks source link

Create an npm package #2

Closed Velover closed 4 months ago

Velover commented 4 months ago

Could you pls create an npm package for @rbxts since it was written / just typed for typescript?

probablytukars commented 4 months ago

I will take a look at it in a couple days when I have the time to, since I haven't made an npm package before. Out of interest, would you also be interested in this being published to wally (package manager for roblox)? Also, if you could tell me more information about your workflow so I can replicate it, that would be much appreciated, by this I mean: What editor are you using, how are you integrating with roblox (rojo), I assume you are using roblox-ts at some point?

Velover commented 4 months ago

I never use Wally and I think npm is enough. As well some methods are missing e.g. .Add .Mul .Pow etc. roblox ts doesn't have these for classes. It would be great if you could add them as well. Right now I'm making sort of animation tooling with bezier/splines. I think your quaternion library can come in handy

Velover commented 4 months ago

and as well it would be great if each of these had a method image

probablytukars commented 4 months ago

I've created an npm package npm i @tukars/luaquaternion is how you can install it.

Also, regarding your second comment, these do have functions, they are quat:Normalize() and quat:Length(), if you are talking about the cached versions, then you can just index using quat.unit and quat.magnitude, unless you are talking about methods to directly access the cached functionality? Please clarify, and if it seems reasonable, I will add them :)

I have never used roblox-ts, so I can't confirm whether or not the types work, I just add them for people who use roblox-ts and requested them. If you know how to add metatable methods into roblox-ts I think they could help other people who use this library also :)

Velover commented 4 months ago

Thank you! It's interesting that you have .d.ts file and you are not using the Roblox TS. About TS you can still set the metametods but you not able to use something like Vector3 + Vector3 so you have to use macros like Vector3.add(Vector3) at the end it compiles to +.

There's no implementations of these macros for classes for now so it's better to add the methods like add mul div etc. I think.

For Roblox TS you have to tell in the .d.ts file that the parameters like . magnitude exist, it's not about the metatables but more about the types

interface ITest{
Test1(): void // compiles to object:Test1()
Test2: () => void // compiles to object.Test2()
}
probablytukars commented 4 months ago

I downloaded roblox-ts just to help fix this issue, I expect it to be finished within ~2 hours because I want to overhaul some metamethods to support strict typing within roblox studio (as a major revision). I apologize for the original delay in getting to this issue and hope I can make the roblox-ts experience much better :)

Velover commented 4 months ago

Thank you a lot for this. Not everyone will decide to try ts just to expand the reach to his package. The time is not a problem, especially if that package will be on npm after this

probablytukars commented 4 months ago

I believe all of your concerns have now been addressed with the release of v2.0.2! If you have any problems let me know, otherwise I will be closing this issue as completed :).

Velover commented 4 months ago

You can as well make an announcement in the RobloxTS server to get more people to download the package

Velover commented 4 months ago

btw why you didnt join rbxts, it will not be considered as valid package

Velover commented 4 months ago

https://roblox-ts.com/docs/guides/typescript-packages

probablytukars commented 4 months ago

No worries, I will take a look at it

probablytukars commented 4 months ago

Issues have now been addressed in the latest release. :)