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: Why are _G functions still locked?

Previous Thread :: Next Thread 
julienmauriemort is not online. julienmauriemort
Joined: 09 May 2009
Total Posts: 21560
20 Dec 2011 10:05 AM
It broke half of the scripts out there, we really need it back!
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
20 Dec 2011 10:10 AM
...what?

_G.f = print

_G.f"cake" --> cake
Report Abuse
Brandonhare is not online. Brandonhare
Joined: 02 May 2007
Total Posts: 11005
20 Dec 2011 10:16 AM
print(_G.print)


_G.purple = print
purple("Test")
Report Abuse
kaboom1 is not online. kaboom1
Joined: 13 Nov 2008
Total Posts: 363
20 Dec 2011 10:25 AM
Brandom, remember: _G.purple("Test")

Yeah. :>
Report Abuse
Brandonhare is not online. Brandonhare
Joined: 02 May 2007
Total Posts: 11005
20 Dec 2011 10:29 AM
That was my point, you can't do that anymore.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
20 Dec 2011 10:32 AM
You can if you have the 08 build.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
20 Dec 2011 10:35 AM
[ Content Deleted ]
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
20 Dec 2011 02:00 PM
http://www.roblox.com/G-Fixing-Script-item?id=66595482
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
20 Dec 2011 02:17 PM
Or a shortened version:

    local fixed = {}
    --Add globals
    
    function copyKeys(from, keys, to)
        --Copy keys `keys` from `from` into `to` (or an empty table), and return it
        t = {} or to
        for _, key in keys do
            t[key] = from[key]
        end
        return t
    end
    
    do
        --fix pseudo-tables
        _G.string = copyKeys(string, {
            "byte", "char", "dump", "find", "format",
            "gmatch", "gsub", "len", "lower", "match",
            "rep", "reverse", "sub", "upper"
        })
        _G.math = copyKeys(math, {
            "abs", "acos", "asin", "atan", "atan2",
            "ceil", "cos", "cosh", "deg", "exp",
            "floor", "fmod", "frexp", "huge", "ldexp",
            "log", "log10", "max", "min", "modf", "pi",
            "pow", "rad", "random", "randomseed", "sin",
            "sinh", "sqrt", "tan", "tanh"
        })
        _G.table = copyKeys(table, {
            "concat", "foreach", "foreachi", "getn", "insert",
            "maxn", "remove", "setn", "sort"
        })
        _G.coroutine = copyKeys(coroutine, {
            "create", "resume", "running", "status", "wrap", "yield"
        })
    
        --variables
    
        --variables
        copyKeys(env, {
            "assert", "delay", "dofile", "error", "_G",
            "game", "workspace", "gcinfo", "getfenv", "getmetatable",
            "ipairs", "load", "loadfile", "loadstring", "next",
            "newproxy", "pairs", "pcall", "print", "rawequal",
            "rawget", "rawset", "select", "setfenv", "setmetatable",
            "Spawn", "tick", "time", "tonumber", "tostring",
            "type", "unpack", "_VERSION", "wait", "xpcall"
        }, _G)
    
        --Classes
        copyKeys(env, {
            "Instance", "BrickColor", "Color3", "CFrame", "Enum",
            "Ray", "UDim", "UDim2", "Vector2", "Vector3"
        }, _G)
    
        --This annoys me
        _G.spawn = _G.Spawn
    end
    
    setmetatable(_G, {
        __index = function(t, k)
            if k == "isFixed" or k == "is_fixed" or k == "fixed" then
                local env = getfenv(2)
                if not fixed[env] then
                    newEnv = {}
                    for k, v in pairs(env) do
                        if not _G[k] then
                            newEnv[k] = v
                        end
                    end
                    setmetatable(newEnv, {
                        __index = _G,
                        __newindex = _G
                    })
                    setfenv(2, newEnv)
                    fixed[newEnv] = true
                end
                return true
            end
        end
    })
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
20 Dec 2011 02:42 PM
Toxic...

~Myrco; Music lover, nederlands/dutch and a scripter
Report Abuse
mew903 is not online. mew903
Joined: 03 Aug 2008
Total Posts: 22071
20 Dec 2011 04:45 PM
for ur_a,noob in pairs(_G) do
getfenv()[ur_a]=noob
end

-- btw ur a noob
Report Abuse
GeniusRobot is not online. GeniusRobot
Joined: 14 Oct 2011
Total Posts: 194
20 Dec 2011 04:53 PM
@Julien, I believe so they have changed _G it still there but to use it it's a different method.
Report Abuse
pwnedu46 is not online. pwnedu46
Joined: 23 May 2009
Total Posts: 7534
20 Dec 2011 04:57 PM
Script 1:
_G.hi = "Hello World!"

Script 2:
print(_G.hi)

> Hello World!


----------
    ~ pwnedu46, the unicorn ~
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
20 Dec 2011 05:24 PM
I just prefer to use one function in the script with the other functions that are supposed to be in _G and use getfenv() to define them on the script wanted.
Report Abuse
Scriptoar is not online. Scriptoar
Joined: 25 Aug 2010
Total Posts: 4025
20 Dec 2011 05:54 PM
@arceus

i liek, sent a join request to your primary. k, trololololol
Report Abuse
Parthax is not online. Parthax
Joined: 27 Apr 2011
Total Posts: 6941
22 Dec 2011 04:15 PM
[ Content Deleted ]
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