Kernell Posted February 9, 2012 Posted February 9, 2012 Lua does not support classes by default. But you can make a pseudo-classes. If you want I can give his library to implement the classes.
Kenix Posted February 9, 2012 Posted February 9, 2012 You can create pseudo-class with metatable. http://lua-users.org/wiki/LuaClassesWithMetatable
Piorun Posted February 9, 2012 Author Posted February 9, 2012 Damn .. dont understand it. Any examples?
Castillo Posted February 9, 2012 Posted February 9, 2012 As far as I know there are examples in that link.
Kernell Posted February 9, 2012 Posted February 9, 2012 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 )
Piorun Posted February 9, 2012 Author Posted February 9, 2012 K thanks. I know there are examples but it's more easier to uderstand when any user who is scripting try to explain it.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now