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: Since I know SH won't help with this, Metatables?

Previous Thread :: Next Thread 
777MrEpic is not online. 777MrEpic
Joined: 17 Oct 2012
Total Posts: 3998
25 Jun 2013 08:51 PM
But how do you make where instead of print you can make it like txt("Hi")
My attempt:
____________________________
local metatable = {
__index = {txt = "print"}
}

local run = setmetatable({}, metatable)
txt("Hi")
____________________________
before telling me to leave, note this is part "advanced"
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
25 Jun 2013 08:52 PM
{txt = print}
Set it to a function, not a string. And yes, this should go in SH, regardless of if they can help or not.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
25 Jun 2013 08:52 PM
You don't want metatables for that.

txt = print

There.
Report Abuse
777MrEpic is not online. 777MrEpic
Joined: 17 Oct 2012
Total Posts: 3998
25 Jun 2013 08:53 PM
>Set it to function
How do you do that, I am about 5 Hrs new to metatables.
Also, I was told if it had anything advanced, it is allowd.
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
25 Jun 2013 08:53 PM
Oh, and you're setting the metatable for the env completely wrong.
Just set local txt = print
Report Abuse
777MrEpic is not online. 777MrEpic
Joined: 17 Oct 2012
Total Posts: 3998
25 Jun 2013 08:53 PM
@Ar I want it to be effiecent as possible for once.
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
25 Jun 2013 08:55 PM
...That is the most efficient. Occam's Razor and all that.
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
25 Jun 2013 09:41 PM
"Also, I was told if it had anything advanced, it is allowd."

Who told you that?
Report Abuse
Parthax is not online. Parthax
Joined: 27 Apr 2011
Total Posts: 6941
25 Jun 2013 09:42 PM
setfenv(1, {txt=print,print=txt})
possible loop, but I don't care as I typed this on a phone.
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
25 Jun 2013 09:43 PM
That's redundant, Parthax.

~ Non simpliciter Latinam legere ~
Report Abuse
Usering is online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
25 Jun 2013 10:36 PM
Well, judging by how long you've been scripting (4 months or so) and these types of scripts (http://www.roblox.com/777MrEpic-39-s-CodeBook-item?id=107934700), I don't think you should be learning this right now. It looks like you still have a long way to go. I didn't learn Metatables until December last year and I started last year in April.
Report Abuse
NVI is not online. NVI
Joined: 11 Jan 2009
Total Posts: 4744
25 Jun 2013 11:01 PM
^^^

Metatables are a simple concept and if you can't figure them out, you shouldn't be scripting at all. There's no set time frame for you to learn anything in Lua.

Metatables simply redefine how tables act. It doesn't require magic.
Report Abuse
777MrEpic is not online. 777MrEpic
Joined: 17 Oct 2012
Total Posts: 3998
25 Jun 2013 11:08 PM
@NVI
Thank you.
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