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: ok wtf kind of problem is this

Previous Thread :: Next Thread 
inapt is not online. inapt
Joined: 04 Oct 2008
Total Posts: 11666
09 Nov 2014 11:17 PM
screwing around with metatables

local meta = {__call = function() end}
local lua = {storage = {}}

meta.__lt = function(self, set)
if self ~= lua then
local data = lua.storage[self] --get the data
print(data) --> PRINTS 10
return data --> RETURNS TRUE????
end
for i = 1, #set, 2 do
lua.storage[set[i]] = set[i + 1]
end
return setmetatable(self, meta)
end

setmetatable(lua, meta)

lua{
lua < {"x", 10} --set x to 10
}

local y = lua > "x" --get x
print(y) --> PRINTS 'true' BUT x IS 10???

using < sets a value, using > gets a value......

in my __lt function where i get the data, i print it and then return it....

it prints 10, but returns true, wtf im tired and done >.>

what am i doing wrong

sorry if i explained this terribly im tired


-ForeverDev
Report Abuse
inapt is not online. inapt
Joined: 04 Oct 2008
Total Posts: 11666
09 Nov 2014 11:18 PM
can the __lt only return a boolean??????


-ForeverDev
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
09 Nov 2014 11:52 PM
mmhm
Report Abuse
inapt is not online. inapt
Joined: 04 Oct 2008
Total Posts: 11666
10 Nov 2014 09:59 AM
:(


-ForeverDev
Report Abuse
EliteDerper is not online. EliteDerper
Joined: 05 Feb 2012
Total Posts: 2288
10 Nov 2014 10:51 AM
why not remove the __'s?

You can simply replace them with another variable, and that will make it less confusing.

Also any outputs?
Report Abuse
inapt is not online. inapt
Joined: 04 Oct 2008
Total Posts: 11666
10 Nov 2014 02:52 PM
its a metatable u froob


-ForeverDev
Report Abuse
EliteDerper is not online. EliteDerper
Joined: 05 Feb 2012
Total Posts: 2288
10 Nov 2014 03:54 PM
says you
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Nov 2014 04:09 PM
Says him, you froob.
Hehe

I'm actually a yoghurt pot today
Report Abuse
EliteDerper is not online. EliteDerper
Joined: 05 Feb 2012
Total Posts: 2288
10 Nov 2014 04:33 PM
i aint a froob :(
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
10 Nov 2014 04:34 PM
who says froob
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Nov 2014 04:35 PM
You aaaare
Report Abuse
EliteDerper is not online. EliteDerper
Joined: 05 Feb 2012
Total Posts: 2288
10 Nov 2014 04:45 PM
I ain't everyone who says that is it himself :3
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