Jump to content

OOP functions


IIYAMA

Recommended Posts

  • Moderators
Posted

I have heard some things about the OOP system, about that it is faster etc.

But is this all ready possible and able to use?

If "yes" were can I find how to use it? Because I have never seen an OOP system.

Thank you

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

As far as I know, LUA doesn't have a way to be used in an OOP. Wish they made it, gawd that would be awesome. But it's not up to the MTA team to do so, it's up to the creators of LUA.

Excuse me, LUA does have the ability to be used in an OOP-application. ._.' It is just... different haha

http://lua-users.org/wiki/ObjectOrientationTutorial

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

  • Moderators
Posted

Meta tables, hmm I have never tried to use them because they never had any extra use for me.

I always did things like this:

local myTable Information = Table1[variable] or Table2[vaiable] 

So it is possible to set a meta table from client to serverside?

Bedankt!

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

hahaha that randomly dutch word there. xD

Ehh I'm not sure. I have never used the OOP shizzle for MTA. It's worth a try I guess? Let me know how it turned out ( if you're going to try, I'll try it too in a sec )

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

  • Moderators
Posted

To be honest I have no idea how to connect those tables. When you send them over with triggerClientEvent, only a copie remains of the table from serverside.

Also when you set the lua file as client and serverside, you also will have a copie.

But I will try to find this secret.

Ik weet niet hoever dit mogelijk is.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted

yes, I had same result.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

As far as I know, MTA will have OOP in a future version, example ( I think ):

local vehicle = createVehicle ( ) 
vehicle:position ( 0, 0, 0 ) 
vehicle:health ( 500 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
As far as I know, MTA will have OOP in a future version, example ( I think ):
local vehicle = createVehicle ( ) 
vehicle:position ( 0, 0, 0 ) 
vehicle:health ( 500 ) 

is that already built in, or will that be update. If so, Can't wait to rewrite everything! :D

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted

It'll be in a future release if I'm right.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
As far as I know, MTA will have OOP in a future version, example ( I think ):
local vehicle = createVehicle ( ) 
vehicle:position ( 0, 0, 0 ) 
vehicle:health ( 500 ) 

MTA 1.4 will have an OOP alternative which can be enabled in the metadata file, yes. I'm working on the official OOP documentation but haven't finished it yet.

local vehicle = Vehicle.create(411, 0, 0, 0) 
vehicle:setPosition(Vector3(0, 20, 0)) 
vehicle:setHealth(500) 
  
-- or 
  
local vehicle = Vehicle.create(411, 0, 0, 0) 
vehicle.position = Vector3(0, 20, 0) 
vehicle.health = 500 

The 1st link mentioned by Jesseunit is the documentation of all classes and their members, which might be outdated now. I'll update it soon and start working on examples.

EDIT: It looks like qaisjp had to mess up with it so I need to fix this later.

I used to know how to code, but then I took an arrow in the knee.

Project Redivivus - Remaking Old School MTA With New Code

MTA 0.6 Nightly 1 released

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...