Hiah. I am trying to implement luaj into my project, and I was hoping to get some help!
I want to implement a Vector class similar to this structure:
http://wiki.roblox.com/index.php?title=API:Vector3
The problem is I can’t seem to find proper documentation on a few things that are necessary. Firstly, I like the .new() convention for constructors, but I am not sure how that would translate to java, as “new” is a protected keyword.
Secondly, how would I go about operator overloading? i.e. Vector3 * Vector3, ect.
Thirdly, I don’t know how to go about creating a property that automatically updates as other properties are changed. For example, in the Vector class I linked: X, Y, Z, Unit, and Magnitude are all fields of a Vector. If X, Y, or Z changes then the Unit and Magnitude variable automatically change. There are no setters or getters.
Ideally I would have most of the functionality in java, and just expose some methods to the user via lua.