Search found 74 matches

by surtic
Sat Dec 06, 2008 4:18 pm
Forum: Support and Development
Topic: require"module" behaviour
Replies: 8
Views: 3896

Re: require"module" behaviour

Would it be possible to also return something from the module, if it returns something? For example: -- xyz.lua ------ local val = "hello" return val -- main.lua ----- local val = love.filesystem.require "xyz.lua" -- val is now nil, should be "hello" The standard 'require' function does return the v...
by surtic
Thu Dec 04, 2008 9:29 pm
Forum: General
Topic: How should I scramble a table?
Replies: 11
Views: 2658

Re: How should I scramble a table?

Kaze, you're right... too many years of bad habits...

Sometimes I do catch myself and use the idom "a, b = b, a" but in many other cases the code just looks right to me...
by surtic
Wed Dec 03, 2008 11:59 pm
Forum: General
Topic: How should I scramble a table?
Replies: 11
Views: 2658

Re: How should I scramble a table?

I think the "standard" way to shuffle an array is this: function shuffle(tab) local len = #tab local r, tmp for i = 1, len do r = math.random(i, len) tmp = tab[i] tab[i] = tab[r] tab[r] = tmp end end http://en.wikipedia.org/wiki/Fisher-Yates_shuffle edit: you can also read a bit more at http://en.wi...
by surtic
Wed Dec 03, 2008 9:09 pm
Forum: Support and Development
Topic: Inefficiencies with loading data
Replies: 8
Views: 2296

Re: Inefficiencies with loading data

Just a tiny suggestion (to Kudomiku): Your code is something like if (x) then return x else x = ... return x end That can be written as if not x then x = ... end return x Then you don't repeat the same line twice. Also, I don't think you need those semi-colons (or the brackets around the condition).
by surtic
Wed Dec 03, 2008 9:01 pm
Forum: General
Topic: picky question about length operator
Replies: 3
Views: 1282

Re: picky question about length operator

As long as you don't have "holes" (i.e. x[1], x[2], x[3] and x[5] are defined, but x[4] is nil), the length operator should do just fine. My suggestion is not to have holes (in fact, my suggestion would be not to mix numbers and strings in the same table: the table's name should give you a clue abou...
by surtic
Wed Dec 03, 2008 8:56 pm
Forum: General
Topic: LÖVE needs a wiki and a ticket system
Replies: 32
Views: 6845

Re: LÖVE needs a wiki

At the time I was looking for an issue tracker for my work (a couple of years ago). I installed Trac and I can't really say anything bad about it - the form you have to fill is minimal, and the integration between the wiki, the issues and subversion is legendary (you can link from the wiki to subver...
by surtic
Tue Dec 02, 2008 11:10 pm
Forum: General
Topic: Community Ideas
Replies: 23
Views: 8531

Re: Community Ideas

Calm down... where is the LÖVE?! ;) I know what subversion is, I'm not complaining about the release cycle of LÖVE (quite impressed actually, especially with the amount of new features in each release). In fact, all I have is praise for this project. I just don't want it to become ClanLib, that's al...
by surtic
Tue Dec 02, 2008 9:55 pm
Forum: General
Topic: Community Ideas
Replies: 23
Views: 8531

Re: Community Ideas

I have a suggestion that might sound ridiculous, but believe me - it is not. As this is a "Community Ideas" thread, here's an idea to keeps the "community" together: keep releasing and re-releasing the library, even if you haven't made too many changes (in fact, even if it's stable as a rock and you...
by surtic
Mon Dec 01, 2008 9:28 pm
Forum: Support and Development
Topic: Bring back readline!
Replies: 16
Views: 4980

Re: Bring back readline!

This is only my opinion (as usual), but I prefer a single mechanism. It's easier on my brain. My preferred solution is to have LÖVE's default main-loop function dofile "game.conf", then create the window (using the parameters from the config file), then run load() etc. That way, the behaviour will b...
by surtic
Mon Dec 01, 2008 9:20 pm
Forum: Support and Development
Topic: Support for saving/loading the Lua state?
Replies: 19
Views: 4898

Re: Support for saving/loading the Lua state?

Regarding saving the Lua state, I've found these posts (quite old): http://lua-users.org/lists/lua-l/2000-07/msg00134.html http://lua-users.org/lists/lua-l/2003-11/msg00003.html Don't know if they are still relevant. In any case I wouldn't recommend saving the entire VM even if it's possible - that'...