generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: What scenarios would you need to use metatables?

Previous Thread :: Next Thread 
Nealz is not online. Nealz
Joined: 29 Nov 2008
Total Posts: 126
10 Apr 2012 11:31 AM
I'm reading the wiki on metatables, they look helpful but I don't see why they would be needed, and why you would need to move to OOP.

Does anyone have aany examples of use?
Report Abuse
Nealz is not online. Nealz
Joined: 29 Nov 2008
Total Posts: 126
10 Apr 2012 11:36 AM
I Forgot to mention, I'm Gergy008 on a friends account. I'm banned you see for stupid reasons. Just so you guys know ;3
Report Abuse
lah30303 is not online. lah30303
Joined: 15 Feb 2008
Total Posts: 10027
10 Apr 2012 12:16 PM
I think xLEGOx used them to create an editable class system on ROBLOX or something like that. I don't really know much about them, so I'm not very sure.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
10 Apr 2012 01:55 PM
[ Content Deleted ]
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
10 Apr 2012 02:00 PM
OOP makes everything SO MUCH EASIER
Report Abuse
nightname is not online. nightname
Joined: 10 Jun 2008
Total Posts: 8960
10 Apr 2012 02:09 PM
Object Oriented Programming simplifies game programming amazingly. By treating different things as objects, you can easily handle their properties.
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
10 Apr 2012 02:13 PM
You don't _NEED_ to use metatables, but they can make scripting easier.
Report Abuse
Nealz is not online. Nealz
Joined: 29 Nov 2008
Total Posts: 126
10 Apr 2012 02:34 PM
What could I treat as an object, and how could I learn more about them? I always love making my scripting easier but it looks awfully confusing.
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
10 Apr 2012 02:36 PM
In RBX.Lua, nothing.
There's really no point to them. Most alternatives of metatables are much more simpler to read and understand.
Report Abuse
gergy008 is not online. gergy008
Joined: 16 Mar 2008
Total Posts: 7039
10 Apr 2012 02:36 PM
Yey I'm unbanned. :3
Report Abuse
gergy008 is not online. gergy008
Joined: 16 Mar 2008
Total Posts: 7039
10 Apr 2012 02:38 PM
Tenal, it makes my scripts look more sophisticated and I'd love to know how to use them just for the fun of it.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
10 Apr 2012 02:38 PM
[ Content Deleted ]
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
10 Apr 2012 02:47 PM
Around a year back I created an alternative to the __add metamethod. It was much simpler, too.
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
10 Apr 2012 02:48 PM
@gergy
Oh, I personally try to make my scripts simple, but the outcome very complex and intricate.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
10 Apr 2012 02:49 PM
[ Content Deleted ]
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
10 Apr 2012 03:18 PM
tenal if you can't see any point you don't truly know lua

I thought I did a year or so ago but I too saw no point in metatables. Now I do.
Report Abuse
Jaccob is not online. Jaccob
Joined: 19 Oct 2008
Total Posts: 986
10 Apr 2012 05:03 PM
Tenal calls me a exploiter.. for whatever reason. I join a game, and I'm exploiting some how.. (by Tenal standards)

From what I can tell.. from past forum posts and this one she doesn't seem very advanced ^_^
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
10 Apr 2012 05:32 PM
[ Content Deleted ]
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
10 Apr 2012 05:40 PM
Example usage:

Vector3.new(1,1,1) + Vector3.new(1,1,1) == Vector3.new(2,2,2)

Rather than:

local vectorA = Vector3.new(1,1,1)
local vectorB = Vector3.new(1,1,1)
local addedVector = Vector3.new(vectorA.x + vectorB.x, vectorA.y + vectorB.y, vectorA.z + vectorB.z)

Top example is cleaner and simpler thanks to metatables.
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
10 Apr 2012 05:54 PM
@jode

you forgot the equality check in the second example xD
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
10 Apr 2012 06:12 PM
"tenal if you can't see any point you don't truly know lua"

I don't see the point of them in Roblox.
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
10 Apr 2012 06:18 PM
There's countless points of them, not as many in roblox, but they still exist.

Wrapping roblox's object system, to simplify stuff is only possible through metatables (Or a stupidly ugly hax implementation)

OOP is very usefull, not as much in roblox, but it's still VERY usefull.

State systems, as someone brought up a few days ago, are greatly simplified by polymorphism and OOP, and therefore that's another use.

Creating tables which can interact through metamethods for APIs/Libraries

I could list a couple more I'm just tired, it's like 00:18 according to my computer clock. I'm only staying up because of a darn browser game which I'm addicted to
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
10 Apr 2012 07:19 PM
@trapping
So, I have to see the point in metatables in order to know Lua?
I really don't understand your logic anymore.
Report Abuse
nightname is not online. nightname
Joined: 10 Jun 2008
Total Posts: 8960
10 Apr 2012 07:21 PM
@Tenal

I showed you my code for the BigNum library. That had to have metatables, or it would not work. I rewrote how tables behaved, and turned them in pseudo-numbers.
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
10 Apr 2012 07:43 PM
Noone understands my logic

I didn't say to know lua at all, I'm more asserting that if you don't see the point you clearly don't fully understand lua as a whole.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image