Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

TIC-80

Fantasy computer for making, playing and sharing tiny games. · By Nesbox

Moonscript

A topic by hashalon created Jan 16, 2017 Views: 2,316 Replies: 9
Viewing posts 1 to 5

Would it be a good idea to implement moonscript as an alternative Language for TIC ?

moonscript compiles into LUA, it implements classes and shorthand operators. And moonscript code require overall less characters than LUA code.

https://moonscript.org/

By that I mean I think it would be more interesting to implement moonscript into TIC rather than implementing shorthands into LUA like how it was done with PICO-8.

What do you think ?

Developer

I haven't had any experience with moonscript before but it looks very laconically.

Great idea, I'll try to investigate it.

Thanks

(+1)

Both LUA and moonscript use ' -- ' as single line comment so maybe a way to allow the use of moonscript would be to use a special tag like "--[moonscript]".

- If the first line of the script as the exact tag "--[moonscript]" then all the code is in moonscript,

- otherwise it is in LUA

--[moonscript]
x = 10
if something
  local x
  x = 12
print x -- prints 10
Developer

seems to be a good idea

Developer (1 edit)

made an issue https://github.com/nesbox/tic.computer/issues/8

If moonscript would be included, can we make it optional? (a function on the beginning: include moonscript or sth)

A big draw to pico8 and/or TIC for me as a new programmer is lua, because it is pretty simple, well documented and popular enough that I can google problems with relative ease.

Moonscript seems a bit more complex from what I see.

Of course moonscript would be optional. TIC like PICO-8 rely on LUA to work.

moonscript is a language that gets converted into LUA to work. (similar to typescript -> javascript or coffeescript -> javascript or Scala -> Java, ...). As such all functions defined in LUA can be used in moonscript (no additional implementation work on that side). However you cannot do an include("moonscript") because the syntax is different than LUA. We should define a comment tag to specify the use of moonscript instead.

Moonscript as it is more complex than LUA shouldn't be the default choice, I agree. But moonscript is also interresting for TIC (and PICO-8) because it requires less lines to do the same things as LUA. And since the screen size is limited, it would help a lot on big project for advanced programmers.

Developer

Moonscript is working in 0.15.0

(+1)

This is amazing !

PICO-8 is dead to me !

Long live the TIC !

Wonderful news... Switch Statement will be 1000% more easy... nice job!