As a way to help people discuss their code, ask for fixes on the forums, or even just try out Moai, I have created http://moaifiddle.com.
If you have used jsfiddle before the usage is similar. Just type your Moai code in the editor window and click play. You will see the result on the right.
Underneath the player is the console. Anything typed into this will be executed within the currently running player as lua code eg print(prop) will output MOAIProp<f34a34>.
On the left is the virtual filesystem, currently I have a bunch of files from the moai samples for your script to reference and a copy of the flower library. To reference these from code just use the path you see on the left eg /img/moai.png.
Click save to save your fiddle and you will see your url change. you can give that link to someone and they can see your fiddle. eg http://moaifiddle.com/Q09BJWGMW6
They can even edit it and play around, but if they hit "update" they will get a new version and a new url eg
http://moaifiddle.com/Q09BJWGMW6/4 <-- the /4 is the 4th revision.
You can embed the player portion of the fiddle into a site by appending /embed to the end of the url and putting it in an iframe like so
- Code: Select all
- <iframe src="http://moaifiddle.com/Q09BJWGMW6/4/embed" style="width:320; height:480"></iframe>
just be sure to add /1 before /embed if it is the first version.
At the moment this only shows the player, but in the future I want it to show the source in a read only view that is syntax highlighted and a run button that swaps to the player, so they can be embedded in future documentation as runnable samples.
PS. it is open source see https://github.com/halfnelson/moaifiddle
@ibisum there might be a way of adding a run button to your moai snippets so that they can be run in a little popover player if you want, and is there an api or a way to create a moaisnippet from a fiddle via a single click. Moaifiddle is just about debugging and not about discovery, that is where moaisnippets is awesome