Hi,
Have been slowly converting some lua extension modules for hollywood from Lua source but keep running in to a lot of examples that require the string modules. Andreas you have done an excellent job of making the language simple (basic esq.) and powerful at the same time but in my effort to learn Lua and to try and extend the Hollywood feature set at a basic level by implementing these modules I decide I would re-write the string implementation.
Now I had to attack this one slightly differently than some of the other modules I have been converting because it is actually a part of the core Lua implementation and is written in C. My first attempt at re-writing some the routines for gsub for example worked well with the the first example and it produced the expected result but a more complex example failed to re-produce the correct output.
I put this down to many things (my experience being the main one) however one common recurring piece of code kept on cropping up and I did my best to try and implement it in lua but I am not certain if it is working correctly. Perhaps someone can give me a better explanation than the one I have read regarding the following C syntax. Understanding the logic will hopefully allow me to re-implement this better than I currently have it hopefully solve my problem.
The statement is simple it is (obviously the variables are nonsensical for this example bt I was more interested in understanding the logic).
Code: Select all
a ? b : c
My attempt at trying to resolve this is to use if else statements
Code: Select all
if a
c
else
b
endif
Dwayne