View Single Post
10-15-20, 02:10 AM   #8
kurapica.igas
A Chromatic Dragonspawn
Join Date: Aug 2011
Posts: 152
Click image for larger version

Name:	Api.png
Views:	350
Size:	558.7 KB
ID:	9498

Just finished the new Cube, it's browser is using the SimpleHtml to show the contents, the main problem is how to simply generate the contents, since we need a complex string concat to generate the html.

I used a trick from my web framework called template string, so the Lua code can be embed into the string, and used to generate the html.

For the example in the pic, the template string is:

https://github.com/kurapica/Cube/blo....lua#L316-L341

And the code that use it to generate the result is :

https://github.com/kurapica/Cube/blo....lua#L154-L160

Just like build a tiny website in the game.

The template string's doc is on PLoop/template-strings if it interesting you.
  Reply With Quote