EGS v2 - Screenshots! Redesign! (Easy GUI System)
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Unnamed GUI library
Or just be careful about the double posting in the future.
Help us help you: attach a .love.
Re: Unnamed GUI library
Robin, we both come from roblox were it doesnt really mater if you double post, so, yeah... ._.
Re: Unnamed GUI library
GijsB, this isn't roblox where it doesn't t really mater if you double so, yeah... ._.
- Trappingnoobs
- Citizen
- Posts: 95
- Joined: Tue Oct 12, 2010 8:52 pm
Re: Unnamed GUI library
Can somone look at my code though, please? I'm not sure whether you've missed the post because it's a page forward.
Second-last post (I think, or third-last or fourth-last) on page 2, I attached a .love (reluctantly )
If you fix it, I'd be REALY gratefull, because it's hindering me and I have no idea in the slightest what's going wrong.
Second-last post (I think, or third-last or fourth-last) on page 2, I attached a .love (reluctantly )
If you fix it, I'd be REALY gratefull, because it's hindering me and I have no idea in the slightest what's going wrong.
Re: Unnamed GUI library
vrld,
sorry, but were not used to it that you can edit posts, and we keep forgetting that, so, yeah... ._.
sorry, but were not used to it that you can edit posts, and we keep forgetting that, so, yeah... ._.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Unnamed GUI library
Your Class.lua is a pile of WTFs. You might want to use an established class library, such as SECS, MiddleClass, HUMP.class, Slither.Trappingnoobs wrote:Can somone look at my code though, please?
Help us help you: attach a .love.
- Trappingnoobs
- Citizen
- Posts: 95
- Joined: Tue Oct 12, 2010 8:52 pm
Re: Unnamed GUI library
I don't like them :-(Robin wrote:Your Class.lua is a pile of WTFs. You might want to use an established class library, such as SECS, MiddleClass, HUMP.class, Slither.Trappingnoobs wrote:Can somone look at my code though, please?
Mine is made just as I'd expect it to. The bit where it asks if the key is a number is basically checking whether it has a default value. Such as this:
{Test, ["Egg"] = 1}
Test wouldn't have a default value; but 'Egg' has a default value of one. - That's the only thing I can see that'd make people wonder what on earth I was doing
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Unnamed GUI library
But that doesn't work at all. Only Test has a number as a key (I can't tell what type the value is, because it is a variable). The other one has 1 as value and "Egg" as key.
Also, that thing with string.dump and loadstring --- you shouldn't need that.
And you should use metatables. That's the only* way you can properly do object orientation in Lua.
* Not really the only way, but close enough.
Also, that thing with string.dump and loadstring --- you shouldn't need that.
And you should use metatables. That's the only* way you can properly do object orientation in Lua.
* Not really the only way, but close enough.
Help us help you: attach a .love.
- Trappingnoobs
- Citizen
- Posts: 95
- Joined: Tue Oct 12, 2010 8:52 pm
Re: Unnamed GUI library
Yeah I'm not the best at explaining.Robin wrote:But that doesn't work at all. Only Test has a number as a key (I can't tell what type the value is, because it is a variable). The other one has 1 as value and "Egg" as key.
Also, that thing with string.dump and loadstring --- you shouldn't need that.
And you should use metatables. That's the only* way you can properly do object orientation in Lua.
* Not really the only way, but close enough.
Say I was programming in C#, and I wanted to make a Dog class, and I was planning in the future to do other classes, I'd do this:
Code: Select all
class LifeForm{
dead = false; --Default value of dead is false
name; --We don't set a default value
}
class Animal : LifeForm{
intelligent = false; --Animals aren't ''intelligent'' as such in general, so we default as false
}
class Dog : Animal{
someProperty;
}
So when you set the key as a string, it assumes it has a default value. If you just put in a value without a key, lua automatically assigns it the next empty number- And it knows it has no default value, so it just sets it to an empty string.
I'm not sure if I explained it well that time, either, but hopefully I did.
The point of the class system is that you can inherit from as many classes as you want- All the other systems I've looked at, including middleclass, only allow you to inherit from one, and are not structured like real implementations of OOP.
Basically this means you could do this:
Code: Select all
Class "Checkbox" {Properties}
Class "TextLabel" {Properties}
Class "CheckboxWithText" ({Properties}, {Checkbox, TextLabel})
For some reason, though, they work FINE, APART from tables inside tables.
My event system, as you've probably seen is structured:
Code: Select all
Event = {
connect = function(s,c)
table.insert(s.functions,c)
end
functions = {}
run = function(s)
for _,v in pairs(s.functions) do
v()
end
end
}
However when two classes have this, they seem to 'share' the table 'Event' between them, so when you do something like this:
Code: Select all
Button:new("Button1")
Button:new("Button2")
Button1.Event:connect(function()
print("Hello from button1")
end)
Button2.Event:connect(function()
print("Hello from button2")
end)
Code: Select all
Button2.Event:run()
>Hello from button1
>Hello from button2
Re: Unnamed GUI library
Pics or it didn't happen
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Who is online
Users browsing this forum: No registered users and 0 guests