Hello, all! I'm new here. I decided it would benefit the community if I shared programming/scripting knowledge, and thus, this is now open source.
This is a simple OOP library I made, called weaverOOP. It's unfinished, but the basic code is here.
[lua]wO={}
wO.global={}
wO.global.clone=function(self) local cloneObj={} for i,v in pairs(self) do cloneObj[i]=v end return cloneObj end
wO.global.isA=function(self, arg)
if self.className==arg then
return true
elseif self.className~="base" then
if wO.classes[self.extends]:isA(arg) then
return true
end
else
return false
end
end
wO.global.className="base"
wO.classes={base=wO.global}
function wO.newClass(a, ...)
arg={...}
b=(arg[1] or {})
b.className=a
b.name=a.."Obj"
if #arg==2 then
b.mt={__index=wO.classes[arg[2]]}
b.extends=arg[2]
else
b.mt={__index=wO.classes["base"]}
b.extends="base"
end
b.mt.__tostring=function(a) return "Class "..a end
b.mt.__call=function(self) return wO.newObj(self.className) end
setmetatable(b, b.mt)
b.mt=nil
wO.classes[a]=b
end
function wO.newObj(a, ...)
arg={...}
local o=(arg[1] or {})
local mt={__index=wO.classes[a]}
mt.__tostring=function(a) return "Object "..o.name..", a "..o.className end
setmetatable(o, mt)
return o
end
setmetatable(_G,{__index=function(_,a) return (a=="newClass" and wO.newClass or (a=="newObj" and wO.newObj or (wO.classes[a] or nil))) end}) --Ugly piece of code.
--Example begins here.
newClass("class",{x=0,y=0})
local t=class()
print(class.x,class.y)
newClass("class2",{z=15},"class")
local t=class2()
print(t.x,t.y,t.z)
[/lua]
API for those to lazy to read my 46 line code:
wO.newClass(string className,table class,[string extends])
creates a class called "classNameHere" where it's simply that table. It'll inherit all the things from the class called extends. (With no extends argument, it uses the global class)
wO.newObj(string className,[table objectValues])
Creates an object of className, with the values of objectValues. (Defaults to {} if not supplied) (deprecated as of 0.1.2)
className([table objectValues])
Equivalent to wO.newObj("className",[table objectValues]). Make sure the metatable of _G has not been changed by another script, this will error it.
Global methods and properties:
obj:isA(string className)
Checks if object obj is or extends an object of className.
obj:clone()
Returns an exact copy of object obj.
obj.name
Specific name of an object, not of much use as of now.
obj.className
The class name of an object, used in global functions and various other items.
I'm trying to add two IntegerValues to the (only - SP game) player's Stats object, but it doesn't seem to work unless I run the script manually with the right-click menu. I've Enabled it, and tried it under World and Players, yet nothing happens. It yields no errors.
I'd appreciate it if someone could check this and tell me if anything's wrong.
Code:
link(game.Players.ChildAdded, function(p)
if p.Type == "Player" then
local score = create("IntegerValue")
score.Name = "Score"
local hiscore = create("IntegerValue")
hiscore.Name = "Hi-Score"
score.Parent = p.Stats
hiscore.Parent = p.Stats --*nothing* happens after all this. Can't even see values in leaderboard.
end
_G.score = function(a) --attempting to use these globals tells me the script tried to reference nil, presumably due to player not being defined.
if p.Stats.Score then
local lescore = p.Stats.Score.Value
local lehiscore = p.Stats["Hi-Score"].Value
lescore = lescore + a
if lescore > lehiscore then
lehiscore = lescore
end
end
end
_G.reset = function()
if p.Stats.Score then
p.Stats.Score.Value = 0
end
end
All of them are either tuxedos or stuff that goes along well with one. Originally I wanted to create the tux for personal use, but I was feeling creative and ended up creating the rest
Reasons;
1. I'll never get my favorite hat.
2. Games suck, they're all laggy pieces of crap that people spent 5 minutes on.
3. sitetest3.roblox.com, the test site, will probably never be back up. I had all my favorite things on there, my Invader name, and a Buildism-like community.
4. They don't care what the users want, for example Reason 3.
5. All the new members. I made my first account back in 08, achieved a Sparkle Time Fedora, and got deleted for swearing at the new people in 2010.
After my '10 deletion I went inactive until last year, and found that Roblox had turned to crap. I decided to stay after I seen a cool new hat that came out, Rainbow Shaggy. It's been my favorite hat ever since. I also saw the ugly 2 new Dominuses. The first two, Infernus and Empyreus, were amazing though.
I'm still debating if I should quit or stay.
That certainly is a surprise, coming back to see how things are going, and my account is gone (along with a lot of other old accounts I see). Took me a while to figure out what was going on...
Um, anyways, the Wikipedia article is interesting, it's nice to see that the site didn't die. Guess I was wrong when I said I was going to stay with buildism for a long time though
There are still names that I remember here, and I also see some new names. It seems there has been a growth in members (I think). How did that happen? And what's with the three captcha's at the registering area? Haha :lol: