<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: [lua] what am i doing wrong?</title>
		<atom:link href="http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 11:52:31 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-33704</guid>
					<title><![CDATA[[lua] what am i doing wrong?]]></title>
					<link>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-33704</link>
					<pubDate>Mon, 17 Sep 2007 01:10:18 +0000</pubDate>
					<dc:creator>joshua goldberg</dc:creator>

					<description>
						<![CDATA[
						<p>hi there.  working on my first attempt at writing lua code, and also  <br />
i&#8217;m an amazingly crappy procedural programmer.  any help on what i&#8217;m  <br />
experiencing would be lovely.  special bonus if the question is  <br />
answered by one of my students (ROB)!</p>
<p>i&#8217;m getting a &#8220;lua pcall error attempt to call a string value&#8221; error  <br />
when my jit.gl.lua object tries to read its file.  where&#8217;s my error?   <br />
(oh, and a line number reference for error messages would be AWESOME,  <br />
please wes)</p>
<p>here&#8217;s the max patch</p>
<p>&#8212;</p>
<p>#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P window linecount 1;<br />
#P message 272 351 30 196617 read;<br />
#P newex 254 424 197 196617 jit.gl.lua bork @file  <br />
josh.planesprinkle.lua;<br />
#P newex 254 381 63 196617 jit.qt.movie;<br />
#P message 134 50 34 196617 reset;<br />
#P newex 134 74 188 196617 jit.gl.handle bork @inherit_transform 1;<br />
#P message 375 135 70 196617 fullscreen $1;<br />
#P toggle 375 115 15 0;<br />
#P newex 375 92 38 196617 sel 27;<br />
#P newex 375 70 40 196617 key;<br />
#P number 91 41 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P user jit.fpsgui 31 178 60 196617 0;<br />
#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;<br />
#P newex 34 245 40 196617 r stuff;<br />
#P toggle 31 47 15 0;<br />
#P newex 128 127 40 196617 s stuff;<br />
#P newex 31 153 201 196617 jit.gl.render bork @erase_color 0. 0. 0. 1.;<br />
#P newex 31 98 58 196617 t b b erase;<br />
#P newex 31 73 57 196617 qmetro 33;<br />
#P newex 375 156 207 196617 jit.window bork @floating 1 @depthbuffer 1;<br />
#P connect 18 0 16 0;<br />
#P fasten 7 9 17 0 237 394;<br />
#P connect 16 0 17 0;<br />
#P connect 7 10 16 0;<br />
#P connect 13 0 0 0;<br />
#P connect 12 0 13 0;<br />
#P connect 11 0 12 0;<br />
#P connect 10 0 11 0;<br />
#P connect 15 0 14 0;<br />
#P connect 2 1 4 0;<br />
#P connect 9 0 1 1;<br />
#P connect 6 0 7 0;<br />
#P connect 3 0 8 0;<br />
#P connect 2 2 3 0;<br />
#P connect 2 0 3 0;<br />
#P connect 14 0 3 0;<br />
#P connect 1 0 2 0;<br />
#P connect 5 0 1 0;<br />
#P window clipboard copycount 19;</p>
<p>
and here&#8217;s josh.planesprinkle.lua</p>
<p>&#8212;</p>
<p>render_context = this.drawto</p>
<p>current = 1<br />
vcount = 32</p>
<p>vplanes = {}</p>
<p>function resetplane(i)<br />
     vplanes[i].color = {1., 1., 1., 1.}<br />
     rand1 = (math.random() &#8211; .5) * 3.<br />
     rand2 = (math.random() &#8211; .5) * 3.<br />
     rand3 = (math.random() &#8211; .5) * 3.<br />
     vplanes[i].position = {rand1, rand2, rand3}<br />
     vplanes[i].scale = {.2, .2, 1.}<br />
end</p>
<p>function setup()</p>
<p>     for i=1, vcount do<br />
         vplanes[i] = jit.new(&#8220;jit.gl.videoplane&#8221;, render_context)<br />
		vplanes[i].automatic = 0<br />
		vplanes[i].blend_enable = 1<br />
		vplanes[i].depth_enable = 0<br />
		vplanes[i].blend_mode = {6, 1}<br />
		resetplane(i)<br />
     end<br />
end</p>
<p>function draw(theplane)<br />
     vplanes[theplane]:draw()<br />
end</p>
<p>function jit_matrix(name)<br />
     current = current + 1<br />
     if (current > vcount) then<br />
         current = 1<br />
     end<br />
     resetplane(current)<br />
     vplanes.[current]:jit_matrix(name)</p>
<p>end</p>
<p>function bang()<br />
     for i=1, vcount do<br />
         draw(i)<br />
     end<br />
end</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-112622</guid>
					<title><![CDATA[Re: [lua] what am i doing wrong?]]></title>
					<link>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-112622</link>
					<pubDate>Mon, 17 Sep 2007 01:24:15 +0000</pubDate>
					<dc:creator>Wesley Smith</dc:creator>

					<description>
						<![CDATA[
						<p>Line 39:<br />
vplanes.[current]:jit_matrix(name)</p>
<p>you have a period before the [].  Indeed I don&#8217;t have syntax error<br />
line reporting.  I&#8217;ll add that for the next release.  Right now I only<br />
have runtime error line reporting.</p>
<p>wes</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-112623</guid>
					<title><![CDATA[Re: [lua] what am i doing wrong?]]></title>
					<link>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-112623</link>
					<pubDate>Mon, 17 Sep 2007 02:03:22 +0000</pubDate>
					<dc:creator>joshua goldberg</dc:creator>

					<description>
						<![CDATA[
						<p>ok, awesome.  next error, happens every render cycle:</p>
<p>lua pcall error [string "render_context = this.drawto..."]:30:  <br />
attempt to index field &#8216;?&#8217; (a nil value)</p>
<p>where&#8217;s this coming from?</p>
<p>(thanks again thanks again)</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-112624</guid>
					<title><![CDATA[Re: [lua] what am i doing wrong?]]></title>
					<link>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-112624</link>
					<pubDate>Mon, 17 Sep 2007 02:12:47 +0000</pubDate>
					<dc:creator>Wesley Smith</dc:creator>

					<description>
						<![CDATA[
						<p>apparently on line 30:</p>
<p>vplanes[theplane]:draw()</p>
<p>theplane is not valid key to the vplanes table which is what &#8220;attempt<br />
to index field &#8216;?&#8217; (a nil value)&#8221; means.  Looks like you need to call<br />
setup() somewhere before drawing starts.</p>
<p>wes</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-112625</guid>
					<title><![CDATA[Re: [lua] what am i doing wrong?]]></title>
					<link>http://cycling74.com/forums/topic/lua-what-am-i-doing-wrong/#post-112625</link>
					<pubDate>Mon, 17 Sep 2007 02:52:39 +0000</pubDate>
					<dc:creator>Rob Ramirez</dc:creator>

					<description>
						<![CDATA[
						<p>hey josh.<br />
you better make good on that special bonus&#8230;</p>
<p>#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P window linecount 1;<br />
#P newex 338 362 55 196617 delay 500;<br />
#P newex 338 340 48 196617 loadbang;<br />
#P newex 254 393 64 196617 prepend call;<br />
#P newex 254 448 32 196617 print;<br />
#P user jit.pwindow 167 405 82 62 0 1 0 0 1 0;<br />
#P message 323 395 53 196617 call setup;<br />
#P message 272 336 30 196617 read;<br />
#P newex 254 424 263 196617 jit.gl.lua bork @file josh.planesprinkle.lua @autowatch 1;<br />
#P newex 254 366 63 196617 jit.qt.movie;<br />
#P message 134 50 34 196617 reset;<br />
#P newex 134 74 188 196617 jit.gl.handle bork @inherit_transform 1;<br />
#P message 375 135 70 196617 fullscreen $1;<br />
#P toggle 375 115 15 0;<br />
#P newex 375 92 38 196617 sel 27;<br />
#P newex 375 70 40 196617 key;<br />
#P number 91 41 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P user jit.fpsgui 31 178 60 196617 0;<br />
#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;<br />
#P newex 34 245 40 196617 r stuff;<br />
#P toggle 31 47 15 0;<br />
#P newex 128 127 40 196617 s stuff;<br />
#P newex 31 153 201 196617 jit.gl.render bork @erase_color 0. 0. 0. 1.;<br />
#P newex 31 98 58 196617 t b b erase;<br />
#P newex 31 73 57 196617 qmetro 33;<br />
#P newex 375 156 207 196617 jit.window bork @floating 1 @depthbuffer 1;<br />
#P connect 13 0 0 0;<br />
#P connect 12 0 13 0;<br />
#P connect 11 0 12 0;<br />
#P connect 10 0 11 0;<br />
#P connect 23 0 24 0;<br />
#P connect 24 0 19 0;<br />
#P connect 17 0 21 0;<br />
#P fasten 7 9 17 0 237 394;<br />
#P connect 19 0 17 0;<br />
#P connect 22 0 17 0;<br />
#P connect 16 0 20 0;<br />
#P connect 16 0 22 0;<br />
#P connect 7 10 16 0;<br />
#P connect 18 0 16 0;<br />
#P connect 15 0 14 0;<br />
#P connect 2 1 4 0;<br />
#P connect 9 0 1 1;<br />
#P connect 6 0 7 0;<br />
#P connect 3 0 8 0;<br />
#P connect 14 0 3 0;<br />
#P connect 2 0 3 0;<br />
#P connect 2 2 3 0;<br />
#P connect 1 0 2 0;<br />
#P connect 5 0 1 0;<br />
#P window clipboard copycount 25;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>render_context = this.drawto</p>
<p>current = 0<br />
vcount = 32</p>
<p>vplanes = {}</p>
<p>function resetplane(i)<br />
	vplanes[i].color = {1., 1., 1., 1.}<br />
	rand1 = (math.random() &#8211; .5) * 3.<br />
	rand2 = (math.random() &#8211; .5) * 3.<br />
	rand3 = (math.random() &#8211; .5) * 3.<br />
	vplanes[i].position = {rand1, rand2, rand3}<br />
	vplanes[i].scale = {.2, .2, 1.}<br />
end</p>
<p>function setup()<br />
	for i=1, vcount do<br />
		vplanes[i] = jit.new(&#8220;jit.gl.videoplane&#8221;, render_context)<br />
		vplanes[i].automatic = 0<br />
		vplanes[i].blend_enable = 1<br />
		vplanes[i].depth_enable = 0<br />
		vplanes[i].blend_mode = {6, 1}<br />
		resetplane(i)<br />
	end<br />
end</p>
<p>function jit_matrix(name)<br />
	current = current + 1<br />
	if (current > vcount) then<br />
		current = 1<br />
	end<br />
	resetplane(current)<br />
	vplanes[current]:jit_matrix(name)<br />
end</p>
<p>function draw()<br />
	for i=1, vcount do<br />
		vplanes[i]:draw()<br />
	end<br />
end</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

