Search found 911 matches
- Wed Jul 31, 2013 5:58 pm
- Forum: Support and Development
- Topic: File lines to table (lua question)
- Replies: 8
- Views: 6662
Re: File lines to table (lua question)
function string_split(text, sep, out) sep, out = sep or "%s", out or {} for s in string_gmatch(text, "([^"..sep.."]+)") do out[#out + 1] = s end return out end or similar should do the job (cut and paste from my utility.lua file). Use like: local some_table = string_sp...
- Wed Jul 31, 2013 5:26 pm
- Forum: Support and Development
- Topic: File lines to table (lua question)
- Replies: 8
- Views: 6662
Re: File lines to table (lua question)
Ok, I'm gonna look into that, I'll post back in a few minutesraidho36 wrote:You can try using foreach loop with string.gsub function.
- Wed Jul 31, 2013 5:17 pm
- Forum: Support and Development
- Topic: File lines to table (lua question)
- Replies: 8
- Views: 6662
Re: File lines to table (lua question)
Print(table) yields table pointer hexadecimal value, which is no use to your Lua code, but if you have it means that table is there. The problem with your code is Lua strings implementation, that is they are not arrays and you can't index them as such. You instead use substirngs. Lua have true immu...
- Wed Jul 31, 2013 3:54 pm
- Forum: Support and Development
- Topic: File lines to table (lua question)
- Replies: 8
- Views: 6662
File lines to table (lua question)
I'd like to know who to load the lines of a file into a table or an array. Here's an exemple file: 0,0,0,0 1,0,1,1 0,1,0,0 0,0,0,0 And I would like to put those lines into a bidimensional array or table like so: line[1][1]=0 ... line[1][4]=0 line[2][1]=1 line[2][2]=0 ... line[2][4]=1 line[3][1]=0 .....
- Tue Jul 23, 2013 3:12 pm
- Forum: General
- Topic: Notepad++ Highlights and Auto-Completion
- Replies: 4
- Views: 6924
Re: Notepad++ Highlights and Auto-Completion
Pretty cool... only one problem: how do you change the colors? I cannot seem to find a way to change them in the settings/style configurator. Would I have to do it manually? To change the colors you have to go User-Defined Languages and in the new window that poped up select LÖVE from the first dro...
- Mon Jul 22, 2013 10:21 pm
- Forum: Support and Development
- Topic: String inside a variable.. inside a variable (variable^2)
- Replies: 4
- Views: 1986
Re: String inside a variable.. inside a variable (variable^2
let me still add a comment .. or two, if I think about it: a) you can iterate over a table that has strings as keys with for k, v in pairs(tbl) --just without "i" b) you can quickly check if a playerID is already in use, if you check if player.thatID == nil -- or player["thatID"...
- Mon Jul 22, 2013 9:43 pm
- Forum: Support and Development
- Topic: String inside a variable.. inside a variable (variable^2)
- Replies: 4
- Views: 1986
Re: String inside a variable.. inside a variable (variable^2
player={} function newPlayer(pname) local n=#player+1 player[n]={} player[n].name=pname return player[n] end p = newPlayer('player 1') print(p.name) I would do like this.. I assume ppname was meant as kind of unique ID? Eventually it is all a bit weird.. do you know what kind of access you need to ...
- Mon Jul 22, 2013 9:11 pm
- Forum: Support and Development
- Topic: String inside a variable.. inside a variable (variable^2)
- Replies: 4
- Views: 1986
String inside a variable.. inside a variable (variable^2)
This is a question about lua, I've searched around the web but I didn't find any answer, so here's the question: I would like to know how I could store a variable(1) inside a variable(2) so when I say variable(2)='foo' then variable(1) would equal 'foo' and variable(2) would equal variable(1) which ...
- Sun Jul 14, 2013 10:39 am
- Forum: Support and Development
- Topic: AnAL Animation problems
- Replies: 2
- Views: 2457
Re: AnAL Animation problems
You need to call "update" for the animation, not just "draw". Currently it never moves on from the first frame. This can be fixed by simply adding: player.anim:update(dt) to the end of your update function. Riiight :megagrin: Totaly forgot about this, thanks Merlin And welcome t...
- Sat Jul 13, 2013 2:57 pm
- Forum: Support and Development
- Topic: AnAL Animation problems
- Replies: 2
- Views: 2457
AnAL Animation problems
Hello again lovers I've found out that I can't use löve's physics to code the player so I've decided to re-write player.lua without them. The problem is that I can't get the animation to play all the frames. When the rectangle falls to the ground and when you press 'a' or 'd' then the player should ...