Jump to content

oop createElement


zixxonx

Recommended Posts

toilet1 = createElement("toilet", "toilet1") 
toilet1:setData("times_used", 0) 

Hello! I'm pretty new to OOP in LUA and i have a problem. It's my code.

But when i run the script it's giving me this error:

attempt to index global 'toilet1' (a userdata value) 

I really dont know why. Could someone help me? OOP is enabled in mtaserver.cnf

Link to comment
  • Other Languages Moderators

https://wiki.multitheftauto.com/wiki/OOP#Turning_it_on

By default, OOP is disabled (however, vectors and matrices are always available) - this is mainly because the vast majority of servers will prefer to stick to what they know - procedural programming. In fact, functions are still available even when OOP is enabled. Enabling OOP is as simple as adding the following line to the resource meta file:
true

mtaserver.conf have nothing to do with oop.

Edited by Guest
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...