Jump to content

Lua classes


Piorun

Recommended Posts

Class Lib: http://pastebin.com/RC1gN4Bs

Class Vector3 for example: http://pastebin.com/WSgK0qFq

Example:

  
pos1 = Vector3( getElementPosition( element ) ); 
pos2 = Vector3( getElementPosition( element2 ) ); 
  
outputChatBox( "Distance between 'element' and 'element2' = " .. pos1:Distance( pos2 ) ); 
  

The Vector3 has operator overloading:

op  name  example

+     Add         v3 = v1 + v2

-      Sub         v3 = v1 - v2

*      Mul          v3 = v1 * v2

==    Equality      if v1 == v2 then ... end

..     Concat        outputDebugString( "Player pos: " .. vec )

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...