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: get table that holds the table that has a function in it

Previous Thread :: Next Thread 
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 09:31 AM
How could I get the 1st table using the table that's inside it?

local tab = {
test = {
function()
--get 'tab'
end
}
}

"My Life is going Good... but..."
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 09:38 AM
can I actually do

local tab = {
test = {
function()
local table = tab
end
}
}

or what?

"My Life is going Good... but..."
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
11 Jul 2015 09:40 AM
Why?

Couldn't you just do tab.Whatever.

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 09:45 AM
yeah I think it works from what I tested :D
am just making something that includes metatables and really needed to know, since I need to use the previous made functions inside the main Table in some functions that are in the same table...

"My Life is going Good... but..."
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
11 Jul 2015 09:46 AM
This is why : syntax exists.
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 09:49 AM
em what exactly are ya saying?
am confused XD

"My Life is going Good... but..."
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
11 Jul 2015 09:52 AM
ex.

local test = {}

test.Thing = function(self)
print(self)
end

test:Thing()
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 09:57 AM
uh, no, I was aiming for,

tab = {
tabl = {
func()
do stuff with tab
end
}
}

since am gonna return tab with my module...

"My Life is going Good... but..."
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
11 Jul 2015 09:58 AM
Then just do tab.whatever
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 10:04 AM
yeah, I said I found out it works XD

"My Life is going Good... but..."
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 10:08 AM
wait!

local timeFuncs = {
['get'] = function()
--other stuff
end
}

--this function is also inside timeFuncs
function()
timeFuncs.get()
end

attempt to index global 'timeFuncs' (a nil value)

"My Life is going Good... but..."
Report Abuse
vacha is not online. vacha
Joined: 06 Jan 2011
Total Posts: 1993
11 Jul 2015 10:08 AM
timeFuncs.get()

while true do the do
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 10:10 AM
"function()
timeFuncs.get()
end"

what does this look like??? o.O

"My Life is going Good... but..."
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 10:20 AM
now it's

attempt to index global 'T' (a nil value)

local T = {h, m, s,

__add = function(s)
local total = timeFuncs.get(T[3], T[2], T[1]) + s
return timeFuncs.get(total)
end;

"My Life is going Good... but..."
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
11 Jul 2015 10:24 AM
local timeFuncs;
timeFuncs = {

};

return timeFuncs;



Prototyping for Lua
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Jul 2015 10:35 AM
I found a way around it, thnx anyways :)

"My Life is going Good... but..."
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