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: How would you make?

Previous Thread :: Next Thread 
IoIiderp is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
24 Mar 2015 08:10 PM
So for example if we make a function:

function printIns(ins)
print(ins:GetFullName())
end

How can you make it you could do:
game.Workspace.BasePlate:printIns() ?
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
24 Mar 2015 08:12 PM
return
Report Abuse
IoIiderp is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
24 Mar 2015 08:13 PM
..?
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
24 Mar 2015 09:32 PM
local function changenumber(num)
return num+10
end

print(changenumber(5)) -- 15
Report Abuse
MakerModelLua is not online. MakerModelLua
Joined: 24 Feb 2013
Total Posts: 3544
24 Mar 2015 10:54 PM
You would need to sandbox the actual code(a more complicated process i don't even fully understand), so you should just stick with

printIns(game.Workspace.BasePlate)


--Siggeh: "asd" - MakerModelLua
Report Abuse
Tuneable is not online. Tuneable
Joined: 16 Feb 2013
Total Posts: 2932
24 Mar 2015 10:55 PM
yeah you gotta do some nasty stuff to achieve that effect

since the whole game hierarchy is just a giant table I would try using metatables
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
24 Mar 2015 10:56 PM
Yeah creating a proxy for all instances just to add custom methods is inefficient and also longer than just doing what MML said
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
24 Mar 2015 11:42 PM
function obj(o)
        return {
                printIns = function()
                        print(o:GetFullName())
                end
        }
end


Usage;
obj(workspace.BasePlate:printIns())

Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
25 Mar 2015 12:34 AM
@Goulstem

Usage:

obj(workspace.BasePlate):printIns();


fixed it ;3
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
25 Mar 2015 12:39 AM
thx m8
Report Abuse
IoIiderp is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
25 Mar 2015 07:07 AM
So I gotta do the haxy stuff? Alright lets get into it :D
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
25 Mar 2015 09:57 AM
here is something small but it works fine

local proxify = function(instance)
local gf = newproxy(true);
local jb = setmetatable({x=5, y=function(self)print(self.x, self.Name);end;}, {__index=instance});
getmetatable(gf).__index = jb;
return gf;
end;

local x = proxify(workspace.BasePlate);
print(x.BrickColor);
x:y();
Report Abuse
IoIiderp is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
25 Mar 2015 09:59 AM
newproxy makes a virtual table that doesn't exist?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
25 Mar 2015 02:04 PM
No, its not a table but userdata and does exist.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
25 Mar 2015 02:06 PM
Frankly, I don't care how inefficient changing the environment is. It's fun and totally worth the 500 lines for a decent one.
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