<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Patches, Fixes, Improvements etc. (new posts)</title>
		<link>http://luagl.wikidot.com/forum/c-14649/patches-fixes-improvements-etc</link>
		<description>Posts in the forum category &quot;Patches, Fixes, Improvements etc.&quot; - Post here, propose,  comment, develop, test Patches, Fixes and another improvements.</description>
				<copyright></copyright>
		<lastBuildDate>Mon, 07 Sep 2026 02:54:50 +0000</lastBuildDate>
		
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18336#post-1120117</guid>
				<title>2007-08 GW Patches (commit 15): Re: 2007-08 GW Patches (commit 15)</title>
				<link>http://luagl.wikidot.com/forum/t-18336/2007-08-gw-patches-commit-15#post-1120117</link>
				<description></description>
				<pubDate>Sat, 09 Apr 2011 08:55:06 +0000</pubDate>
				<wikidot:authorName>pradahandbags</wikidot:authorName>				<wikidot:authorUserId>835995</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>The Prada Naplack Milano Shopper in brown is a beautiful exact replica designer handbag that looks and feels exactly like the real thing. Because the product looks like the real thing, no one will know that it isn’t. These designer handbags are made using the same materials that the originals are made from, which means that they not only look as great but last just as long. This black Milano backpack is ideal for a casual day or for a work day, especially if you are wearing <a href="http://www.pradahandbagsonsale.com">prada handbags on sale</a> business attire. You can, however, mix it together with brighter clothes as well, as the dark brown goes with almost any outfit you can mix it with. mens prada sunglasses Chanel handbags are one of the most popular handbag lines in the world, with a long line of tradition and rubber stamped quality. Despite recent demand for other brands such as Coach Handbags, the Chanel line easily outranks many other brands in terms of demand and use by other fashion socialites. Any lady who is spotted with a Chanel handbag slung over her shoulder or swinging by her arm is automatically regarded highly. This identity and its accompanying popularity have naturally led to many imitators in the high end fashion world. It has also brought about many replicas and in its worst times, fake imitations of the originals.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-1120116</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-1120116</link>
				<description></description>
				<pubDate>Sat, 09 Apr 2011 08:54:48 +0000</pubDate>
				<wikidot:authorName>pradahandbags</wikidot:authorName>				<wikidot:authorUserId>835995</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>When Mario's granddaughter took over the leather goods company in 1978, the business was struggling. She was a former mime with a PhD in political science. Despite her lack of <a href="http://www.pradahandbagsonsale.com">prada handbags on sale</a> fashion qualification she transformed the Prada company in to the most recognizable fashion brands on the planet. prada wallet It is not surprising that many people began to know the fashion logo Prada only after the popular of the film named The Devil Wears Prada. This Italian fashion label is specialized on luxury goods and is synonymous with opulence and high-end quality. It is regarded as a status symbol, thus here is the answer to the question in the title: only these fabulous and highly fashion-conscious people carry Prada handbag</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-32414#post-1120115</guid>
				<title>glut window number &amp; glut_destroy_window: Re: glut window number &amp; glut_destroy_window</title>
				<link>http://luagl.wikidot.com/forum/t-32414/glut-window-number-glut-destroy-window#post-1120115</link>
				<description></description>
				<pubDate>Sat, 09 Apr 2011 08:54:33 +0000</pubDate>
				<wikidot:authorName>pradahandbags</wikidot:authorName>				<wikidot:authorUserId>835995</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>After Miuccia Prada took over the company in 1970, as an extraordinary talented designer, the company has been steered into the right direction and a whole new level of development. Focusing on a new creative, modern line. prada wallets for men Prada is also well known for its creative and unique designs. For <a href="http://www.pradahandbagsonsale.com">prada handbags on sale</a> example, let's consider the recent, widely popular, Gaufre leather collection. This series of bags, made from genuine leather, has the Prada logo located boldly in front. It comes in a variety of colors, like black, white, brown, and even orange.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-105495#post-329184</guid>
				<title>Bugfixes: Re: Bugfixes</title>
				<link>http://luagl.wikidot.com/forum/t-105495/bugfixes#post-329184</link>
				<description></description>
				<pubDate>Sun, 07 Dec 2008 20:54:30 +0000</pubDate>
								<wikidot:authorUserId>28310</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Questions: which source branch? compiler/platform?</p> <p>In the case that you are on Windows XP, can you sent me the binaries you produced?</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-105495#post-309957</guid>
				<title>Bugfixes: Bugfixes</title>
				<link>http://luagl.wikidot.com/forum/t-105495/bugfixes#post-309957</link>
				<description></description>
				<pubDate>Sun, 16 Nov 2008 17:19:42 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>First thanks for providing this binding for openGL ;)</p> <p>However I found it troublesome to use this lib due to weird crashes. I finally found the glitch which is located in get_array2f. The function is not balancing the lua VM stack. I fixed the loop that caused a stackoverflow that lead to a crash somewhat later (thus hard to track down the error).</p> <div class="code"> <pre><code> for(i = 0; i &lt; n; i++) { lua_rawgeti(L, index, i+1); if(!lua_istable(L, -1)) { lua_pop(L,1); // undo the change to the stack, normally not necessary return -1; } for(j = 0; j &lt; *size; j++) { lua_rawgeti(L, -1, j + 1); (*array)[i*(*size) + j] = (GLfloat)lua_tonumber(L, -1); lua_pop(L, 1); // lua_remove(L,-1) equivalent } lua_pop(L,1); // pop the row off }</code></pre></div> <p>I also saw during examination that there is a memory leak in the texture function gl_tex_image.<br /> The function returned without freeing the pixels array, i.e.</p> <div class="code"> <pre><code> if((height = get_array2f(L, 4, &amp;pixels, &amp;width)) != -1) { glTexImage2D(GL_TEXTURE_2D, (GLint)lua_tonumber(L, 1), iformat, width/iformat, height, 0, e, GL_FLOAT, pixels); free(pixels); // I added this line return 0; }</code></pre></div> <p>In other places existed the same glitch.</p> <p>&#8212;zet</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-33505#post-302980</guid>
				<title>SVN Trunk: Re: SVN Trunk</title>
				<link>http://luagl.wikidot.com/forum/t-33505/svn-trunk#post-302980</link>
				<description></description>
				<pubDate>Fri, 07 Nov 2008 20:26:47 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Why isn't LuaGL using another extension manager like Glew or GLEE that seem a lot more efficient?<br /> Also GLUT should be overtaken. GLFW is the project that is more up to date as far as OpenGL Utilities are concerned</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-33505#post-86130</guid>
				<title>SVN Trunk: SVN Trunk</title>
				<link>http://luagl.wikidot.com/forum/t-33505/svn-trunk#post-86130</link>
				<description></description>
				<pubDate>Wed, 02 Jan 2008 22:54:33 +0000</pubDate>
				<wikidot:authorName>fabiowguerra</wikidot:authorName>				<wikidot:authorUserId>9823</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hello,</p> <p>I copied my SVN branch to trunk. It has a lot of improvents, bugfixes and is more stable than LuaGL 1.01.<br /> I recommend everyone to use this version.</p> <p>It can be downloaded using the followin command:</p> <blockquote> <p><span style="white-space: pre-wrap;">svn&#32;co&#32;https://luagl.svn.sourceforge.net/svnroot/luagl/trunk</span></p> </blockquote> <p>For those who don't have SVN installed, it can be downloaded at &lt;subversion.tigris.org&gt;.</p> <p>The new LuaGL version will be released probably on March. It will be backward compatible with the previous versions.<br /> It need only some small changes and a Makefile, probably using autoconf and automake to configure OpenGL, GLU and Glut libs.</p> <p>I'm accepting help to build this Makefile, since i'm out of time to work on LuaGL until March.</p> <p>Fabio</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-32414#post-85082</guid>
				<title>glut window number &amp; glut_destroy_window: Re: glut window number &amp; glut_destroy_window</title>
				<link>http://luagl.wikidot.com/forum/t-32414/glut-window-number-glut-destroy-window#post-85082</link>
				<description></description>
				<pubDate>Sun, 30 Dec 2007 02:48:49 +0000</pubDate>
				<wikidot:authorName>fabiowguerra</wikidot:authorName>				<wikidot:authorUserId>9823</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi 'Anonyous',</p> <p>Thanks for your suggestion I implemented glut.DestroyWindow in my SVN branch. It will be on the next release.<br /> But my implementation is a little different from yours.</p> <p>I changed glut.CreateWindow to return the window identifier. And the glut.DestroyWindow will receive the identifier.<br /> This way it will be possible to handle multiple windows.</p> <p>I recomend everyone to use the SVN version, there are lots of improvements and bug fixes there..</p> <p>PS: The next release will happen only on March or April, because I will defend my MSc Dissertation on March. But it is almost done, but I still need to create a makefile to it. Any suggestions for the makefile? Need to use autoconf/automake?</p> <p>Fabio</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-32414#post-83132</guid>
				<title>glut window number &amp; glut_destroy_window: glut window number &amp; glut_destroy_window</title>
				<link>http://luagl.wikidot.com/forum/t-32414/glut-window-number-glut-destroy-window#post-83132</link>
				<description></description>
				<pubDate>Sun, 23 Dec 2007 03:26:07 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <div> <p>So the main question is: where the glut window number will be stored and how will be accessed?</p> </div> <p>To quickly add glut.DestroyWindow function do the following:</p> <ul> <li>Edit <strong>luaglut.c</strong> file.</li> <li>Add new line after all <strong>#include</strong> directives, such as:</li> </ul> <div class="code"> <div class="hl-main"> <pre><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">window</span><span class="hl-code">;</span></pre></div> </div> <ul> <li>Prepend line in function <strong>glut_create_window</strong> with <strong>window=</strong> so it look like this:</li> </ul> <div class="code"> <div class="hl-main"> <pre><span class="hl-identifier">window</span><span class="hl-code"> = </span><span class="hl-identifier">glutCreateWindow</span><span class="hl-brackets">((</span><span class="hl-types">const</span><span class="hl-code"> </span><span class="hl-types">char</span><span class="hl-code"> *</span><span class="hl-brackets">)</span><span class="hl-identifier">lua_tostring</span><span class="hl-brackets">(</span><span class="hl-identifier">L</span><span class="hl-code">, </span><span class="hl-number">1</span><span class="hl-brackets">))</span><span class="hl-code">;</span></pre></div> </div> <ul> <li>Add new function <strong>glut_destroy_window</strong>:</li> </ul> <div class="code"> <div class="hl-main"> <pre><span class="hl-types">static</span><span class="hl-code"> </span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">glut_destroy_window</span><span class="hl-brackets">(</span><span class="hl-identifier">lua_State</span><span class="hl-code"> *</span><span class="hl-identifier">L</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">glutDestroyWindow</span><span class="hl-brackets">(</span><span class="hl-identifier">window</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-number">0</span><span class="hl-code">; </span><span class="hl-brackets">}</span></pre></div> </div> <ul> <li>Add new constant into <strong>glutlib</strong> at the end of file</li> </ul> <div class="code"> <div class="hl-main"> <pre><span class="hl-brackets">{</span><span class="hl-quotes">&quot;</span><span class="hl-string">DestroyWindow</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">glut_destroy_window</span><span class="hl-brackets">}</span></pre></div> </div> <p>That is it.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-52521</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-52521</link>
				<description></description>
				<pubDate>Thu, 27 Sep 2007 05:14:53 +0000</pubDate>
				<wikidot:authorName>wes</wikidot:authorName>				<wikidot:authorUserId>12550</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Yes, that while loop is really inefficienct and this thread is a discussion to make that conversion better. As for your second question, to put a function in lua, it has to have a particular signature ( int func(lua_State *) ) so what you describe is not possible unless it's a userdata which would require another kind of overhead so it doesn't really matter in the end and they way functions like glEnd are wrapped is the most ideal solution for Lua.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-52481</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-52481</link>
				<description></description>
				<pubDate>Wed, 26 Sep 2007 23:43:10 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Ah I see. I was asking because I saw that string flag array in the source and I couldn't help but think that looping through an array like that isn't the most efficient method to check for flags.</p> <p>Another thing I noticed in the source is that you've made functions to call gl functions that don't take arguments and don't give returns, like glEnd. In this case can't you just use a pointer to the original gl function instead? I don't know much about C but I've tried it in FreeBasic and it does work</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-51907</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-51907</link>
				<description></description>
				<pubDate>Tue, 25 Sep 2007 13:36:19 +0000</pubDate>
				<wikidot:authorName>gwpl</wikidot:authorName>				<wikidot:authorUserId>3313</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>We are going to provide support for both notations:</p> <p>gl.Clear(&quot;DEPTH_BUFFER_BIT | COLOR_BUFFER_BIT&quot;)<br /> gl.Clear(gl.DEPTH_BUFFER_BIT + gl.COLOR_BUFFER_BIT)</p> <p>We provide first notation cause there is a possiblity that bitwise oprations can give other results some times.<br /> Second one gives better performance.</p> <p>Best.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-51245</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-51245</link>
				<description></description>
				<pubDate>Sat, 22 Sep 2007 18:22:25 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>This might be a stupid question, by why are you even using strings for this? In lua player they put the values of the flags directly into lua variables, then when passing the flags you just add them together.</p> <p>Now, I know that adding them isn't the same as doing a bitwise or, but it works just fine in lua player so why can't it work here?</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-49071</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-49071</link>
				<description></description>
				<pubDate>Fri, 14 Sep 2007 15:31:35 +0000</pubDate>
				<wikidot:authorName>wes</wikidot:authorName>				<wikidot:authorUserId>12550</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>yes I know it's C++ :] My reasons for using C++ are to take advantage of the already quite fast string C++ STL class. Also later on in my branch I plan on using C++ for dynamic buffers, small object allocators, and higher-level representations. I differ here from you and Grzegorz in that I don't care so much about ANSI C compatibility, just widely available ISO C++. If it works with microsoft's compiler and GCC then I'm satisfied.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-48900</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-48900</link>
				<description></description>
				<pubDate>Thu, 13 Sep 2007 21:32:30 +0000</pubDate>
				<wikidot:authorName>fabiowguerra</wikidot:authorName>				<wikidot:authorUserId>9823</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Ok, but it is C++ not C.</p> <p>I think it's a little waste of time, two people doing the same work&#8230;</p> <p>But anyway I'll create a small performance test to this feature. The fastest patch (that compiles in ANSI C without warnings) will be on the next release.</p> <p>In my branch I modified the unit test to use a modified version of luaunit (original version was not working with lua5.1), i will try to commit a get_enum test in end of this week.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-48861</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-48861</link>
				<description></description>
				<pubDate>Thu, 13 Sep 2007 17:11:16 +0000</pubDate>
				<wikidot:authorName>wes</wikidot:authorName>				<wikidot:authorUserId>12550</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>BTW, this code is located in branches/wesleysmith/trunk_merge/src/LuaGL.cpp</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-48860</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-48860</link>
				<description></description>
				<pubDate>Thu, 13 Sep 2007 17:10:27 +0000</pubDate>
				<wikidot:authorName>wes</wikidot:authorName>				<wikidot:authorUserId>12550</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I just comitted my get_enum code to a modded trunk in my branch. I had to do some extra things to get LuaGL trunk to compile on OSX and some additional things to get it to work as a C++ file. It works with the following mask techniques:</p> <p>gl.Clear(&quot;DEPTH_BUFFER_BIT,COLOR_BUFFER_BIT&quot;)<br /> gl.Clear(&quot;DEPTH_BUFFER_BIT, COLOR_BUFFER_BIT&quot;)<br /> gl.Clear(&quot;DEPTH_BUFFER_BIT ,COLOR_BUFFER_BIT&quot;)<br /> gl.Clear(&quot;DEPTH_BUFFER_BIT , COLOR_BUFFER_BIT&quot;)<br /> gl.Clear(&quot;DEPTH_BUFFER_BIT|COLOR_BUFFER_BIT&quot;)<br /> gl.Clear(&quot;DEPTH_BUFFER_BIT| COLOR_BUFFER_BIT&quot;)<br /> gl.Clear(&quot;DEPTH_BUFFER_BIT |COLOR_BUFFER_BIT&quot;)<br /> gl.Clear(&quot;DEPTH_BUFFER_BIT | COLOR_BUFFER_BIT&quot;)</p> <div class="code"> <pre><code>15a16,19 &gt; &gt; #if defined (__APPLE__) || defined (OSX) &gt; #include &lt;stdlib.h&gt; &gt; #else 16a21,25 &gt; #endif &gt; &gt; #ifdef __cplusplus &gt; extern &quot;C&quot; { &gt; #endif 19a29,36 &gt; #ifdef __cplusplus &gt; } &gt; #endif &gt; &gt; #include &lt;string&gt; &gt; &gt; using namespace std; &gt; 21a39,41 &gt; #define LUA_GL_STRING_TO_ENUM_TABLE &quot;LuaGL_string_to_enum_table&quot; &gt; #define LUA_GL_ENUM_TO_STRING_TABLE &quot;LuaGL_enum_to_string_table&quot; &gt; 32c52 &lt; static GLenum get_enum(const char *str, int n) --- &gt; GLenum get_enum(lua_State *L, const char *key) 34c54 &lt; int i = 0; --- &gt; GLenum val; 36,39c56,57 &lt; while(gl_str[i].str != 0) &lt; { &lt; if(strncmp(str, gl_str[i].str, n) == 0 &amp;&amp; gl_str[i].str[n] == 0) &lt; return gl_str[i].value; --- &gt; lua_getfield(L, LUA_REGISTRYINDEX, LUA_GL_STRING_TO_ENUM_TABLE); &gt; lua_getfield(L, -1, key); 41c59,60 &lt; i++; --- &gt; if(lua_isnil(L, -1)) { &gt; val = ENUM_ERROR; 43c62,63 &lt; return ENUM_ERROR; --- &gt; else { &gt; val = (GLenum)lua_tointeger(L, -1); 45,49c65 &lt; static GLenum get_gl_enum(lua_State *L, int index) &lt; { &lt; unsigned int i; &lt; const char *str = lua_tostring(L, index); &lt; GLenum temp = 0, ret = 0; --- &gt; lua_pop(L, 2); //pop value and enum table 51c67,70 &lt; for(i = 0; i &lt; strlen(str); i++) --- &gt; return val; &gt; } &gt; &gt; GLenum get_gl_mask_enum(lua_State *L, const char *key, char token) 53c72,77 &lt; if(str[i] == ',') --- &gt; GLenum val = 0; &gt; string mask(key); &gt; size_t pos = 0, substr_start = 0, last_pos = 0; &gt; &gt; pos = mask.find(token, substr_start); &gt; while(last_pos != string::npos) 55,57c79,90 &lt; temp = get_enum(str, i); &lt; if(temp != ENUM_ERROR) &lt; ret |= temp; --- &gt; int end_off = 0; &gt; &gt; //check for leading and trailing spaces &gt; if(mask[substr_start] == ' ') { &gt; substr_start++; &gt; } &gt; &gt; if(mask[pos - substr_start - 1] == ' ') { &gt; end_off = 1; &gt; } &gt; &gt; string bit = mask.substr(substr_start, pos - substr_start - end_off); 59,60c92,96 &lt; str += i+1; &lt; i = 0; --- &gt; val |= get_enum(L, bit.c_str()); &gt; &gt; substr_start = pos+1; &gt; last_pos = pos; &gt; pos = mask.find(token, substr_start); 61a98,99 &gt; &gt; return val; 63d100 &lt; temp = get_enum(str, strlen(str)); 65c102 &lt; if(temp == ENUM_ERROR) --- &gt; LUAGL_API GLenum get_gl_enum(lua_State *L, int index) 67,69c104,116 &lt; if(ret == 0) &lt; return ENUM_ERROR; &lt; return ret; --- &gt; const char *key = lua_tostring(L, index); &gt; GLenum val = 0; &gt; char token1 = ',', token2 = '|' ; &gt; &gt; //detect if multiple enums as a bit mask &gt; if(strchr(key, token1)) { &gt; val = get_gl_mask_enum(L, key, token1); &gt; } &gt; else if(strchr(key, token2)) { &gt; val = get_gl_mask_enum(L, key, token2); &gt; } &gt; else { &gt; val = get_enum(L, key); 72c119 &lt; return ret | temp; --- &gt; return val; 75c122 &lt; static const char *get_str_gl_enum(GLenum num) --- &gt; LUAGL_API const char *get_str_gl_enum(lua_State *L, GLenum num) 77c124 &lt; unsigned int i = 0; --- &gt; const char *val; 79,82c126,130 &lt; while(gl_str[i].str != 0) &lt; { &lt; if(num == gl_str[i].value) &lt; return gl_str[i].str; --- &gt; lua_getfield(L, LUA_REGISTRYINDEX, LUA_GL_ENUM_TO_STRING_TABLE); &gt; lua_pushnumber(L, num); &gt; lua_gettable(L, -2); &gt; val = lua_tostring(L, -1); &gt; lua_pop(L, 2); //pop value and enum table 84,86c132 &lt; i++; &lt; } &lt; return NULL; --- &gt; return val; 202c248 &lt; static int get_array2d(lua_State *L, int index, GLdouble **array, int *size) --- &gt; static int get_array2d(lua_State *L, int index, GLdouble **array, GLint *size) 215c261 &lt; *size = luaL_getn(L, -1); --- &gt; *size = (GLint)luaL_getn(L, -1); 238c284 &lt; static int get_array2f(lua_State *L, int index, GLfloat **array, int *size) --- &gt; static int get_array2f(lua_State *L, int index, GLfloat **array, GLsizei *size) 251c297 &lt; *size = luaL_getn(L, -1); --- &gt; *size = (GLsizei)luaL_getn(L, -1); 526,529d571 &lt; const char *arg; &lt; const char *delims = &quot;|,&quot;; &lt; char arg_buffer[256]; &lt; char *result = NULL; 532,549c574,576 &lt; // test argument type &lt; if(lua_type(L, 1) != LUA_TSTRING) { &lt; script_error(L, &quot;incorrect argument to function 'gl.Clear'&quot;); &lt; } &lt; &lt; arg = lua_tostring(L, 1); &lt; &lt; if(strlen(arg) &gt; 256) { &lt; script_error(L, &quot;incorrect argument to function 'gl.Clear'&quot;); &lt; } &lt; &lt; strcpy(arg_buffer, arg); &lt; result = strtok(arg_buffer, delims); &lt; while( result != NULL ) { &lt; printf(&quot;result: %s\n&quot;, result); &lt; result = strtok(NULL, delims); &lt; } &lt; --- &gt; /* test argument type */ &gt; if(!lua_isstring(L, 1)) &gt; luaL_error(L, &quot;incorrect argument to function 'gl.Clear'&quot;); 553,556c580,582 &lt; // test argument &lt; if(e == ENUM_ERROR) { &lt; script_error(L, &quot;incorrect string argument to function 'gl.Clear'&quot;); &lt; } --- &gt; /* test argument */ &gt; if(e == ENUM_ERROR) &gt; luaL_error(L, &quot;incorrect string argument to function 'gl.Clear'&quot;); 557a584 &gt; /* call opengl function */ 1418c1445 &lt; static gl_front_face(lua_State *L) --- &gt; static int gl_front_face(lua_State *L) 1503c1530 &lt; int mask; --- &gt; GLint mask; 1641c1668 &lt; str = get_str_gl_enum(params[i]); --- &gt; str = get_str_gl_enum(L, params[i]); 1766c1793 &lt; lua_pushstring(L, get_str_gl_enum(error)); --- &gt; lua_pushstring(L, get_str_gl_enum(L, error)); 1950c1977 &lt; int size; --- &gt; GLint size; 2020c2047 &lt; glGetPointerv(e, (void *)&amp;flags); --- &gt; glGetPointerv(e, (GLvoid **)&amp;flags); 2035c2062 &lt; glGetPointerv(e, (void *)&amp;params); --- &gt; glGetPointerv(e, (GLvoid **)&amp;params); 2096c2123 &lt; int e2; --- &gt; GLint e2; 2113c2140 &lt; lua_pushstring(L, get_str_gl_enum(e2)); --- &gt; lua_pushstring(L, get_str_gl_enum(L, e2)); 2142c2169 &lt; int e3; --- &gt; GLint e3; 2160c2187 &lt; lua_pushstring(L, get_str_gl_enum(e3)); --- &gt; lua_pushstring(L, get_str_gl_enum(L, e3)); 2183c2210 &lt; int width, height, level; --- &gt; GLint width, height, level; 2258c2285 &lt; int e; --- &gt; GLint e; 2293c2320 &lt; lua_pushstring(L, get_str_gl_enum(e)); --- &gt; lua_pushstring(L, get_str_gl_enum(L, e)); 2412c2439 &lt; static gl_is_list(lua_State *L) --- &gt; static int gl_is_list(lua_State *L) 2425c2452 &lt; static gl_is_texture(lua_State *L) --- &gt; static int gl_is_texture(lua_State *L) 4108a4136,4139 &gt; #ifdef __cplusplus &gt; extern &quot;C&quot; { &gt; #endif &gt; 4110a4142,4172 &gt; &gt; //make sting_to_enum table &gt; lua_pushstring(L, LUA_GL_STRING_TO_ENUM_TABLE); &gt; lua_newtable(L); &gt; { &gt; int i=0; &gt; while(gl_str[i].str) &gt; { &gt; lua_pushstring(L, gl_str[i].str); //strings as enum keys &gt; lua_pushinteger(L, gl_str[i].value); //enum value as values &gt; lua_settable(L, -3); //set table with (key, value) pair &gt; i++; &gt; } &gt; } &gt; lua_settable(L, LUA_REGISTRYINDEX); &gt; &gt; //make enum_to_string table (not unique) &gt; lua_pushstring(L, LUA_GL_ENUM_TO_STRING_TABLE); &gt; lua_newtable(L); &gt; { &gt; int i=0; &gt; while(gl_str[i].str) &gt; { &gt; lua_pushinteger(L, gl_str[i].value); //enum value as keys &gt; lua_pushstring(L, gl_str[i].str); //strings as enum values &gt; lua_settable(L, -3); //set table with (key, value) pair &gt; i++; &gt; } &gt; } &gt; lua_settable(L, LUA_REGISTRYINDEX); &gt; 4112a4175,4178 &gt; &gt; #ifdef __cplusplus &gt; } &gt; #endif</code></pre></div> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-48598</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-48598</link>
				<description></description>
				<pubDate>Wed, 12 Sep 2007 23:48:41 +0000</pubDate>
				<wikidot:authorName>wes</wikidot:authorName>				<wikidot:authorUserId>12550</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I'll work &quot;, &quot; &quot;,&quot; and &quot;|&quot; into my patch. I just got back home to california and will be preparing a diff for my get_enum code soon.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-48523</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-48523</link>
				<description></description>
				<pubDate>Wed, 12 Sep 2007 17:14:58 +0000</pubDate>
				<wikidot:authorName>fabiowguerra</wikidot:authorName>				<wikidot:authorUserId>9823</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Its a good idea.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://luagl.wikidot.com/forum/t-18381#post-47867</guid>
				<title>2007-08 gw patch on get_enum: Re: 2007-08 gw patch on get_enum</title>
				<link>http://luagl.wikidot.com/forum/t-18381/2007-08-gw-patch-on-get-enum#post-47867</link>
				<description></description>
				<pubDate>Mon, 10 Sep 2007 16:04:16 +0000</pubDate>
				<wikidot:authorName>gwpl</wikidot:authorName>				<wikidot:authorUserId>3313</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>What do you think ,<br /> maybe add support to &quot;|&quot; character as well ?<br /> To make a &quot;C&quot; like look : &quot;SHT1 | SHT2&quot; ?<br /> Or Is it &quot;unnecessary&quot; feature ?</p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>