ËNVY (LÖVE Framework)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Merkoth
Party member
Posts: 186
Joined: Mon Feb 04, 2008 11:43 pm
Location: Buenos Aires, Argentina

Re: ËNVY (LÖVE Framework)

Post by Merkoth »

+1 to the ass part.

I'm currently writing a little game and decided to give ENVY a try, everything cool so far. The only thing I'd suggest is to also add a "blank" game to the distribution.
User avatar
mike
Administrator
Posts: 364
Joined: Mon Feb 04, 2008 5:24 pm

Re: ËNVY (LÖVE Framework)

Post by mike »

Merkoth wrote:The only thing I'd suggest is to also add a "blank" game to the distribution.
Good idea. Perhaps for the beginner looking into coding with Lua/LÖVE, ËNVY would be a great place to start if you added a barebones game that showed a few coding conventions and good ideas.
Now posting IN STEREO (where available)
User avatar
Tad2020
Prole
Posts: 9
Joined: Fri Feb 06, 2009 12:00 am

Re: ËNVY (LÖVE Framework)

Post by Tad2020 »

Is it just me or is LÖVE not calling the metamethod __type? I'm having problems with ËNVY's vector class causing C STACK OVERFLOWS, I traced it down to the type calls returning "table" instead of "vector". I figured something might be wrong with my OOP module (using own, not ËNVY's), but tostring is fine and __type works when called directly.
User avatar
Kaze
Party member
Posts: 189
Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland

Re: ËNVY (LÖVE Framework)

Post by Kaze »

Tad2020 wrote:Is it just me or is LÖVE not calling the metamethod __type? I'm having problems with ËNVY's vector class causing C STACK OVERFLOWS, I traced it down to the type calls returning "table" instead of "vector". I figured something might be wrong with my OOP module (using own, not ËNVY's), but tostring is fine and __type works when called directly.
__type isn't part of standard Lua.
User avatar
Tad2020
Prole
Posts: 9
Joined: Fri Feb 06, 2009 12:00 am

Re: ËNVY (LÖVE Framework)

Post by Tad2020 »

Kaze wrote:__type isn't part of standard Lua.
That's strange, I sworn that I've used it with the standalone Lua bin before, I guess my memory is mistaken. Time to override type() then :P
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: ËNVY (LÖVE Framework)

Post by osuf oboys »

I believe it would be better if you used a custom function for this. Some libraries for optimizations, serialization, copying, and the like may need to know whether your data is stored as a table or not.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
User avatar
Tad2020
Prole
Posts: 9
Joined: Fri Feb 06, 2009 12:00 am

Re: ËNVY (LÖVE Framework)

Post by Tad2020 »

osuf oboys wrote:I believe it would be better if you used a custom function for this. Some libraries for optimizations, serialization, copying, and the like may need to know whether your data is stored as a table or not.
Yeah.... I think I put back a isinstanceof() function to my object system instead (or just check for x & y). That was a crazy idea, I stopped overriding things in Lua years ago.
User avatar
Kuromeku
Party member
Posts: 166
Joined: Sun Jul 20, 2008 5:45 pm

Re: ËNVY (LÖVE Framework)

Post by Kuromeku »

In ENVY's main.lua exists this:

Code: Select all

-- This is the worst thing since Garry Glitter.
local rawtype = type;

-- This is the worst thing since Garry Glitter.
type = function(variable)
	local metatable = getmetatable(variable);

	-- Check if the type is valid.
	if (metatable and metatable.__type) then
		return metatable.__type(variable);
	else
		return rawtype(variable);
	end;
end;
User avatar
Tad2020
Prole
Posts: 9
Joined: Fri Feb 06, 2009 12:00 am

Re: ËNVY (LÖVE Framework)

Post by Tad2020 »

Kudomiku wrote:

Code: Select all

-- This is the worst thing since Garry Glitter.
I think his name is with one "r", Gary Glitter.


I just did metaclass.__vector = true since all I needed to know is if it is, or derived from, a vector. I had to rewrite most of that class anyway, I was getting "C Stack Overflow"s every time I used any of the metamethods.

Code: Select all

-- Called when a vector is added with another variable.
function vector:__add(a)
	if type(a) == "number" then
		return vector(self.x + a, self.y + a)
	elseif a.__vector then
		return vector(self.x + a.x, self.y + a.y)
	end
end
I also added __le and __lt, it was missing those and they're very useful for checking in a point is in a quad.
User avatar
Kuromeku
Party member
Posts: 166
Joined: Sun Jul 20, 2008 5:45 pm

Re: ËNVY (LÖVE Framework)

Post by Kuromeku »

This is now licenced under LPCL.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 6 guests