[jitter] [lua] what am i doing wrong?
Wesley Smith
wesley.hoke at gmail.com
Sun Sep 16 20:12:47 MDT 2007
- Previous message: [jitter] [lua] what am i doing wrong?
- Next message: [jitter] Re: [lua] what am i doing wrong?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
apparently on line 30: vplanes[theplane]:draw() theplane is not valid key to the vplanes table which is what "attempt to index field '?' (a nil value)" means. Looks like you need to call setup() somewhere before drawing starts. wes On 9/16/07, joshua goldberg <wugmump at speakeasy.org> wrote: > ok, awesome. next error, happens every render cycle: > > lua pcall error [string "render_context = this.drawto..."]:30: > attempt to index field '?' (a nil value) > > where's this coming from? > > (thanks again thanks again) > > > On Sep 16, 2007, at 9:24 PM, Wesley Smith wrote: > > > Line 39: > > vplanes.[current]:jit_matrix(name) > > > > you have a period before the []. Indeed I don't have syntax error > > line reporting. I'll add that for the next release. Right now I only > > have runtime error line reporting. > > > > wes > > > > > > On 9/16/07, joshua goldberg <wugmump at speakeasy.org> wrote: > >> hi there. working on my first attempt at writing lua code, and also > >> i'm an amazingly crappy procedural programmer. any help on what i'm > >> experiencing would be lovely. special bonus if the question is > >> answered by one of my students (ROB)! > >> > >> i'm getting a "lua pcall error attempt to call a string value" error > >> when my jit.gl.lua object tries to read its file. where's my error? > >> (oh, and a line number reference for error messages would be AWESOME, > >> please wes) > >> > >> here's the max patch > >> > >> --- > >> > >> #P window setfont "Sans Serif" 9.; > >> #P window linecount 1; > >> #P message 272 351 30 196617 read; > >> #P newex 254 424 197 196617 jit.gl.lua bork @file > >> josh.planesprinkle.lua; > >> #P newex 254 381 63 196617 jit.qt.movie; > >> #P message 134 50 34 196617 reset; > >> #P newex 134 74 188 196617 jit.gl.handle bork @inherit_transform 1; > >> #P message 375 135 70 196617 fullscreen \$1; > >> #P toggle 375 115 15 0; > >> #P newex 375 92 38 196617 sel 27; > >> #P newex 375 70 40 196617 key; > >> #P number 91 41 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > >> #P user jit.fpsgui 31 178 60 196617 0; > >> #P newex 34 269 416 196617 t b b b b b b b b b b b b b b b b b b b; > >> #P newex 34 245 40 196617 r stuff; > >> #P toggle 31 47 15 0; > >> #P newex 128 127 40 196617 s stuff; > >> #P newex 31 153 201 196617 jit.gl.render bork @erase_color 0. 0. > >> 0. 1.; > >> #P newex 31 98 58 196617 t b b erase; > >> #P newex 31 73 57 196617 qmetro 33; > >> #P newex 375 156 207 196617 jit.window bork @floating 1 > >> @depthbuffer 1; > >> #P connect 18 0 16 0; > >> #P fasten 7 9 17 0 237 394; > >> #P connect 16 0 17 0; > >> #P connect 7 10 16 0; > >> #P connect 13 0 0 0; > >> #P connect 12 0 13 0; > >> #P connect 11 0 12 0; > >> #P connect 10 0 11 0; > >> #P connect 15 0 14 0; > >> #P connect 2 1 4 0; > >> #P connect 9 0 1 1; > >> #P connect 6 0 7 0; > >> #P connect 3 0 8 0; > >> #P connect 2 2 3 0; > >> #P connect 2 0 3 0; > >> #P connect 14 0 3 0; > >> #P connect 1 0 2 0; > >> #P connect 5 0 1 0; > >> #P window clipboard copycount 19; > >> > >> > >> and here's josh.planesprinkle.lua > >> > >> --- > >> > >> render_context = this.drawto > >> > >> current = 1 > >> vcount = 32 > >> > >> vplanes = {} > >> > >> function resetplane(i) > >> vplanes[i].color = {1., 1., 1., 1.} > >> rand1 = (math.random() - .5) * 3. > >> rand2 = (math.random() - .5) * 3. > >> rand3 = (math.random() - .5) * 3. > >> vplanes[i].position = {rand1, rand2, rand3} > >> vplanes[i].scale = {.2, .2, 1.} > >> end > >> > >> function setup() > >> > >> for i=1, vcount do > >> vplanes[i] = jit.new("jit.gl.videoplane", render_context) > >> vplanes[i].automatic = 0 > >> vplanes[i].blend_enable = 1 > >> vplanes[i].depth_enable = 0 > >> vplanes[i].blend_mode = {6, 1} > >> resetplane(i) > >> end > >> end > >> > >> function draw(theplane) > >> vplanes[theplane]:draw() > >> end > >> > >> function jit_matrix(name) > >> current = current + 1 > >> if (current > vcount) then > >> current = 1 > >> end > >> resetplane(current) > >> vplanes.[current]:jit_matrix(name) > >> > >> end > >> > >> function bang() > >> for i=1, vcount do > >> draw(i) > >> end > >> end > >> > >> > >> > >> > >> > >> _______________________________________________ > >> jitter mailing list > >> jitter at cycling74.com > >> http://www.cycling74.com/mailman/listinfo/jitter > >> > > _______________________________________________ > > jitter mailing list > > jitter at cycling74.com > > http://www.cycling74.com/mailman/listinfo/jitter > > > > > _______________________________________________ > jitter mailing list > jitter at cycling74.com > http://www.cycling74.com/mailman/listinfo/jitter >
- Previous message: [jitter] [lua] what am i doing wrong?
- Next message: [jitter] Re: [lua] what am i doing wrong?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
