2DWorlds Forums
Custom Object Guide - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13)
+--- Thread: Custom Object Guide (/showthread.php?tid=5831)



Custom Object Guide - Dignity - 06-15-2011

More information at http://buildism.net/wiki/w/index.php?title=Custom_Objects#Coding

[lua]
Int = {} --Yes, its a table
function Int:new(one, two, three) --here I set the properties.
newTB = {x, y, z}
newTB.x = one
newTB.y = two
newTB.z = three

return newTB
end

a = Int.new(5, 8, 1) --Here we are using Int the same as Vec2D.
print(a.x) --5
print(a.y) --8
print(a.z) -- 1
[/lua]

Look over it. Simple. I'm gussing this is the same way (for you ROBLOXians) Instance.new works.


RE: Custom Object Guide - Qwertygiy - 06-15-2011

Nice! I've messed around with custom methods once or twice, but you actually made something useful! Cool.


RE: Custom Object Guide - Dignity - 06-15-2011

Thanks.


RE: Custom Object Guide - Qwertygiy - 06-15-2011

I found a typo in your comment though.

Properties. Not perporties.


RE: Custom Object Guide - Dignity - 06-15-2011

I'm horrible at spelling.
Finished the In-Death.