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 » Game Design
Home Search
 

Re: ShadowOfCrimson's SH Thread

Previous Thread :: Next Thread 
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 07:02 AM
SH is gone, let us all remember the former glory. *moment of silence*

But since it's gone, I've decided to help out with a Thread where I help you with your SH problems!

To make it easier on the both of us, I'd prefer you post like this:

[Describe problem or if you don't know]
[Code 5-6 lines of problematic code]
[Output here]

Thanks in advance,
~Shadow~
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:16 AM
What does getfenv do, stop saying get the envoirment because when people say that, I think of forests and stuff, WHAT ENVOIRMENT. Example and stuff pl0x. also setfenv

now other stuff I don't know what does

rawequal
rawget
rawset
newproxy



Explain.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:22 AM
i'd love to see you answer that :3
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 07:24 AM
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#setfenv

All of that is documented right here sir :)
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:26 AM
I copied them from the wiki because we both don't know what wiki means about them :)

I said, explain :D
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:27 AM
Nvm I red the wiki this time, explain newproxy and setfenv and getfenv, parts of wiki I don't know. k
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 07:28 AM
For the most part, I don't usually specify the difference between global variables and their environments, being that you could have multiple environments to separate out the globals. Why you would even need something like this is beyond me.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:30 AM
lol sorry, I just came here to tease you really :P

But yeah I need to find out what newproxy and the fenv's does...
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 07:31 AM
http://lua-users.org/wiki/HiddenFeatures

That is a good page explaining why they aren't commonly used, and I kinda knew you were teasing me, but I had to appease you :)

also newproxy looks like it makes a new (if this was java) class with a blank table for properties.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:34 AM
They are used if you are doing stuff with metatables, like I do and finding more st00f out.

It's more useful than people may think, alot easier to manipulate them, etc.
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 07:34 AM
Just by curiosity, by a game-making perspective, where do metatables most often occur?
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:37 AM
Well, the thing is you don't have to use metatables unless you make some hacky stuff, like those pro scripters do. But they are quite useful because you can do things in your script alot easier because you can manipulate so much with them.

I don't know how to explain it really, if you learn it you will see they are quite useful and abit fun to use.
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 07:38 AM
When I think of metatables, I think of datapoints and terrain generation and storage manipulation, is that accurate?
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:39 AM
And those raw stuff (rawget,rawequal,rawset), is quite more useful than I thought and kind off good I just realized what they did, metatables can make stuff fire when you do things with a table but by using one of the raw's you can avoid the metatable functionality/bypass it.

Alot easier to understand if you learn it.
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 07:46 AM
Anywhere I should start if I decided to go ahead and see what these metatables are all about?
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:47 AM
Well yes, it could be used for something like that.

table1 = {stuff = "hellothere"}

--metatable = {} -- in here you use one of the metamethod, here is an example of one which is _call

metatable = {
__call = function(table, arguments)
local k = {arguments}
for _,v in pairs(k) do
print(v) end
end
}

setmetatable(table1,metatable)

table1("lol")

basically you can call a table as a function by using that metamethod
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 07:49 AM
I suggest the wiki because it covers the metamethods in examples,explonations.
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
18 Nov 2014 07:59 AM
"What does getfenv do, stop saying get the envoirment because when people say that, I think of forests and stuff, WHAT ENVOIRMENT. Example and stuff pl0x. also setfenv"


The "environment" is simply just the table that the function is currently in, as an example:


A = {}

function B()
setfenv(1,A) --'1' refers to the function "B" in this example.
C = 100
end
B()

print(C) --This will print nil simply because "C" is in a different environment altogether from "print".

However, if you utilized something such as,

print(getfenv(B).C) --This would work simply because "getfenv" retrieves the "environment" of the function.
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 08:17 AM
I read two different pages on metatables, ended up being thoroughly discouraged from using them because I don't use anything that would require them or could be made easier in using them. I really don't get it lol
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 08:24 AM
Ah I get it anyony.
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
18 Nov 2014 08:24 AM
"I read two different pages on metatables, ended up being thoroughly discouraged from using them because I don't use anything that would require them or could be made easier in using them. I really don't get it lol"


In the majority of situations, the usage of metatables would be entirely inessential.


Although, metatables are essentially extension tables connected to a central table that allows for more versatile functionality of the central table.


Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
18 Nov 2014 08:25 AM
"Although, metatables are essentially extension tables connected to a central table that allows for more versatile functionality of the central table."

Damn that explonation, so true.

In metatables you can manipulate the table SO much basically.
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 08:45 AM
So if I ever want to add two tables together or something weird like that, use Metatables, but essentially I don't really need them?
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
18 Nov 2014 08:51 AM
"So if I ever want to add two tables together or something weird like that, use Metatables, but essentially I don't really need them?"


You could utilize metatables to accomplish something similar to that.


I'll provide you with a link that might help you:
http://lua-users.org/wiki/MetamethodsTutorial
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
18 Nov 2014 09:02 AM
I read the reference link, it makes me want to:

while true do
self:Destroy()
end

--see what I did there? it has no wait and also kills me :D
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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