Karoffe Posted January 14, 2015 Share Posted January 14, 2015 Sets the metatable for the given table. (You cannot change the metatable of other types from Lua, only from C.) If metatable is nil, removes the metatable of the given table. If the original metatable has a "__metatable" field, raises an error.This function returns table. What's the use of this table ? and what's the difference between it and a normal table ? How can I use it ? Link to comment
novo Posted January 14, 2015 Share Posted January 14, 2015 (edited) Refer to this website for a deep explanation: http://nova-fusion.com/2011/06/30/lua-m ... -tutorial/ Anything you need to know about metatables is explained there, though in case you do not comprise something make sure to question about it. Edited January 14, 2015 by Guest Link to comment
Gallardo9944 Posted January 14, 2015 Share Posted January 14, 2015 (edited) Metatables give usual tables "special abilities" (Thanks to ixjf for the correcting me) (symlink to another table, lock itself, make some tasks simpler, create sandboxes). There is a dx library in default race resource, you can see how you can code OOP with metatables. Edited January 14, 2015 by Guest Link to comment
ixjf Posted January 14, 2015 Share Posted January 14, 2015 Metatables aren't a kind of table. Metatables change the behavior of tables. http://www.lua.org/pil/13.html Link to comment
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