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 » Scripting Helpers
Home Search
 

Re: Fix this pleaseeeee

Previous Thread :: Next Thread 
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
16 Aug 2012 08:39 PM
setmetatable({}, {__call = function(...) table.foreach({...}, function(_, var) assert(loadstring(string.dump(var))()); end); end;})(function() print("Fix me D:") end, function() print("Oh noes") end, (function() return (getfenv(0)['script'] ~= script); end)());

kk thanx
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
16 Aug 2012 08:42 PM
setmetatable({}, {__call = function(...)
table.foreach({...},
function(_, var)
assert(loadstring(string.dump(var))());
end); end;})
(function() print("Fix me D:") end,
function() print("Oh noes") end,
(function() return (getfenv(0)['script'] ~= script);
end)());

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
16 Aug 2012 08:42 PM
Derp, I hit the Post button instead of the Back button.
Anyway, there's no point to it, you're setting the __call metamethod to a table without a name.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
16 Aug 2012 08:44 PM
setmetatable returns the table it's being set to.

local myTable = setmetatable({}, {}); -- returns the first table given
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
16 Aug 2012 08:46 PM
I know, but you never assigned any variables.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
16 Aug 2012 08:48 PM
Why would I need to in this case? It's not setmetatable that's wrong, it's how I'm using __call.
Report Abuse
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
16 Aug 2012 08:52 PM
There's nothing wrong with the syntax by the way.
Report Abuse
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
16 Aug 2012 08:55 PM
Nobody knows qq?
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
16 Aug 2012 08:58 PM
table.foreach is deprecated.
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
16 Aug 2012 08:58 PM
Ohhhh, I see what you mean....
Still don't know what's wrong, but I get what you said before :D

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
16 Aug 2012 08:59 PM
Was foreach removed from Lua 5.2?

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
16 Aug 2012 09:00 PM
Not sure, I'd heard of it before now, but never really understood it, so I went to the wiki and it says:
"This item is deprecated; use the pairs() function instead!"
Might not be removed from Lua 5.2 but it is from RBX.Lua :/
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
16 Aug 2012 09:01 PM
@mama
No, deprecated means it's still usable, but there are better options. You can still use it in Roblox, but I don't think you can in Lua 5.2

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
16 Aug 2012 09:02 PM
Oh, I thought deprecated meant that they took it out o.O..
Report Abuse
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
16 Aug 2012 09:03 PM
It's usable in RBX.Lua (right now). I guess nobody knows how to fix it lol.
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
16 Aug 2012 09:06 PM
Why do you have () after your last end?

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
16 Aug 2012 09:16 PM
It executes the function q.q

(function() print("Hi") end)()

would work the same as

function hi()
print("Hi")
end
hi()
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
16 Aug 2012 09:22 PM
Did not know that...

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
16 Aug 2012 09:22 PM
You should learn Lua, I heard a game called ROBLOX uses it.
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
16 Aug 2012 09:26 PM
Wow, I was about to thank you for teaching me these things, but then you go and make fun of me for not already knowing them.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
16 Aug 2012 09:44 PM
> "Make fun of"

What's fun about this?
Report Abuse
mew903 is not online. mew903
Joined: 03 Aug 2008
Total Posts: 22071
17 Aug 2012 01:38 AM
Bump
Report Abuse
BobbyisLOLZ is not online. BobbyisLOLZ
Joined: 17 Aug 2010
Total Posts: 8045
17 Aug 2012 01:43 AM
xd
Report Abuse
DarkShadow01 is not online. DarkShadow01
Joined: 19 Nov 2007
Total Posts: 25
24 Aug 2012 03:22 AM
bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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