Defold Codepad

How many of you know about ?
It’s a great site I use a lot to see what different compilers do to the code I write. It’s quite informative.

And, perhaps you didn’t know we have a similar tool, for Defold, called codepad:

With it, you can choose a collection, write some test code, and then see the result.

The source is available on github, and we’d very much like to see this way of writing quick examples grow even further:

To post an example, you put it in an iframe:

<iframe width="100%" height="800" frameborder="0" scrolling="no" marginheight="0"
 marginwidth="0" src="CODEPAD_URL"></iframe>

And the CODEPAD_URL is the one you get from pressing “Share” in the code pad.

And here’s what it looks like.


One good way to use this would be to infuse our documentation with small codepad links that explain the behavior of a function or a concept, interactively.


I use the codepad all the time when I need to find out how exactly something embarassingly simple works and don’t want to test it in the project I have open at the moment.


This will come in handy, for sure.

I think your links have issues, though. They all appear to be Slack redirects, which don’t work for me.


:open_mouth::heart_eyes_cat: wow this is great!

I’m in <3, this is like but with Defold!

“Try it here or host your own custom version.”

Where to start if I wanted to host my custom version? With the possibility also of sharing code URLs?
I don’t know nothing about web servers programming. I only know about getting shared hosting plans and installing Wordpress :stuck_out_tongue: !

A good solution is to use GitHub Pages:

That is how we host the website and codepad.

1 Like

Do I need to do something special to make the “share” button work?
When people click share, the code need to be saved somewhere and a new URL is created. Is all this handled by the codepad app?

The url contains the settings + code as base 64 encoded info (iirc)

1 Like

:heart_eyes_cat::open_mouth::heart_eyes_cat::open_mouth: oh! great!

How could we get input to work in Codepad?

Just use print,
pprint doesn’t work in codepad.

1 Like

Indeed, the input is working, the pprint not :smiley: Thank you!

Hmm, why is that?

I didn’t check it myself, I just know it doesn’t work

Probably because only print was monkey patched but not pprint?

1 Like

It would be nice to have a iFrame button on Forum for codepad. Is it possible?

I believe we looked into a tighter forum integration with the codepad a few years ago. I can’t recall what came out of it…