Search found 7 matches

by sroccaserra
Thu Feb 12, 2009 1:23 pm
Forum: General
Topic: Code for collisions
Replies: 20
Views: 9537

Re: Code for collisions

About spaceships (as mentionned by Peter Hickman in this thread): In many "modern" 2D shmups (i.e. post 1994), the hitbox of the spaceship and bullets are rectangles slightly smaller than their respective sprites, allowing them to slightly overlap without exploding. This prevents the "exploding with...
by sroccaserra
Thu Feb 05, 2009 10:04 pm
Forum: General
Topic: Can I require "package.file" instead of "package/file.lua"?
Replies: 16
Views: 5587

Re: Can I require "package.file" instead of "package/file.lua"?

Yes, that's the problem: I can't change the source code of the libs, most of them making their requires with the "package.file" syntax. However, I looked at the Lua C source code and reimplemented the "loader_Lua" (mapped to package.loaders[2], see "loadlib.c") and "findfile" functions in Lua, adapt...
by sroccaserra
Thu Feb 05, 2009 7:48 am
Forum: General
Topic: Can I require "package.file" instead of "package/file.lua"?
Replies: 16
Views: 5587

Re: Can I require "package.file" instead of "package/file.lua"?

Ok, thanks.

And did you try to package the LUBE code within your .love file, for users that don't have LUBE installed? That's what I'm trying to do.
by sroccaserra
Wed Feb 04, 2009 9:34 pm
Forum: General
Topic: Can I require "package.file" instead of "package/file.lua"?
Replies: 16
Views: 5587

Re: Can I require "package.file" instead of "package/file.lua"?

I eventually wrote a Lua loader that allows me to require Lua files by calling "require 'package.file'" instead of "require 'package/file.lua'". It's not great, but it's all I have so far. local loader = function(fileName) local file = fileName:gsub("%.", "/")..'.lua' return package.loaders[5](file)...
by sroccaserra
Wed Feb 04, 2009 5:37 pm
Forum: General
Topic: Can I require "package.file" instead of "package/file.lua"?
Replies: 16
Views: 5587

Re: Can I require "package.file" instead of "package/file.lua"?

Is there a template value that could be added to packag.path (like './?.lua') that would make "require 'package.file'" work? I couldn't find any.

Alternatively, has someone writen a package loader that accomplishes the same thing?

Cheers!
by sroccaserra
Wed Feb 04, 2009 3:17 pm
Forum: General
Topic: Can I require "package.file" instead of "package/file.lua"?
Replies: 16
Views: 5587

Re: Can I require "package.file" instead of "package/file.lua"?

Ok, I found out. [Edit] Or not. I have a directory named "SomeGame", where my main.lua and all Lua source files reside. Then, I start the game from outside the directory, with the command "love SomeGame". So, to require "SomeGame/package/file.lua", the following works: package.path = "./SomeGame/?.l...
by sroccaserra
Wed Feb 04, 2009 12:12 pm
Forum: General
Topic: Can I require "package.file" instead of "package/file.lua"?
Replies: 16
Views: 5587

Can I require "package.file" instead of "package/file.lua"?

Hi, thanks for this awsome framework in this great programming language. I try to package some existing Lua libs in a LÖVE project, but I have some troubles with "require". A lot of existing Lua code use the following syntax to require the file "package/file.lua": require "package.file" This doesn't...