Questions tagged [moonscript]

MoonScript is a dynamic scripting language that compiles into Lua

MoonScript provides a syntax that uses significant whitespace as an alternative to keywords seen in standard Lua scripts.

Tag question with if you have issues compiling it into Lua or issues with its dynamic compiler called Moonloader.

Additional topics that can be addressed in questions with this tag:

  • table comprehensions
  • implicit return on functions
  • classes
  • inheritance
  • scope management statements import & export
  • with (object creation statement)

Principle website

21 questions
4
votes
1 answer

Luarocks Failed to Compile Object

I'm pretty new to using things like luarocks to install libraries, and I'm running into a problem I'm not sure how to fix when installing the dependencies for Lapis. As you can see, I have none of the dependencies installed for Lapis (I assume that…
user3196935
  • 61
  • 1
  • 6
3
votes
2 answers

Installing moonscript via luarocks on Windows

When I try to install moonscript through luarocks, the process errors out in installing the dependencies for moonscript, saying that "cl" isn't an installed / recognized program. C:\Users\Kingdaro>luarocks install moonscript Installing…
kingdaro
  • 11,528
  • 3
  • 34
  • 38
2
votes
1 answer

Lapis not using values from config.moon

I'm following the guides on leafo.net/lapis to create a configuration file. My config.moon is in the top level folder of the app and looks like this config = require "lapis.config" config "development", -> port 5001 When I run lapis build or…
Samo
  • 8,202
  • 13
  • 58
  • 95
2
votes
1 answer

Unit testing a moonscript awesome config

What I am trying to do to learn some lua/moonscript is migrate my awesome configuration file (rc.lua) to moonscript and unit-test a few things along the way. For this I set up rc.lua to require the moonscript config file like this package.path =…
ulmeyda
  • 23
  • 2
1
vote
1 answer

How do I iterate over characters in a string?

In moonscript, how can I iterate over characters in a string? I tried iterating as if the string was a table, but that did not work: s = "hello" for c in *s print c
congusbongus
  • 13,359
  • 7
  • 71
  • 99
1
vote
2 answers

How to debug moonscript?

I trying to write some game, based on Love2d framework, compiled from moonscript. Every time when I make a mistake in my code, my application throws error and this error refers to compiled lua-code, but not a moonscript, so I have no idea where…
Beast Winterwolf
  • 229
  • 2
  • 11
1
vote
1 answer

How to call a function from moonscript in lua?

I've got a moon script code like this: hello = (name) -> print "Hello #{name}!" And i want to use it in my lua code using moonscript.loadfile how should i do something like that?
AmirhCo
  • 13
  • 1
  • 6
1
vote
1 answer

bundling moon.lua dependency

I'm making a game in lua with Love2D and have successfuly bundled it into an .exe for distributon. However, I recently switched to moonscript, and now after compiling and bundling the executable can't start on another computer because it doesn't…
Ludwik
  • 2,247
  • 2
  • 27
  • 45
1
vote
1 answer

Moonscript static fields

I want to make class like that: class Example field: false --some field shared for all instances of the class init: (using field) -> field = true --want to change value of the static field above But in lua I got: <...> field = false, init =…
Niro
  • 59
  • 1
  • 5
1
vote
0 answers

Can you have test specific dependencies on lua?

Can lua's rockspec specify testing only dependencies somewhat akin to how Python achieves it using tests_require which download dependencies onto a local folder instead of installing them system wide ?
Muhammad Lukman Low
  • 8,177
  • 11
  • 44
  • 54
1
vote
1 answer

How to require and use moonscript functions

This looks very simple but has me stumped, I have a function like this: print_stuff = (name) -> name defined in a folder called pale_moonlight so it's here: pale_moonlight/function.moon. When I try calling it like this: > f = require…
Muhammad Lukman Low
  • 8,177
  • 11
  • 44
  • 54
1
vote
1 answer

What does the '*all' in file.read for moonscript mean?

In moonscript, what does the *all when reading a file mean ? Sample script: file = io.open('README.md', "rb") content = file\read("*all") If there is a *all are there other pointers that reads half the file etc?
Muhammad Lukman Low
  • 8,177
  • 11
  • 44
  • 54
1
vote
2 answers

Why does io\open not work in moonscript?

Moonscript uses \ to call methods so can someone explain to me why the code below does not work: > file = io\open("mix.exs", "rb") [string "tmp"]:1: calling 'open' on bad self (string expected, got table) but when you call it to read the file it…
Muhammad Lukman Low
  • 8,177
  • 11
  • 44
  • 54
1
vote
1 answer

How to find if an array is subset of another array?

In Python we can use set or itertools to find the subset of one list of another list, how do we do the same in Lua ? a = {1,2,3} b = {2,3} How do i check that b is a subset of a ?
Muhammad Lukman Low
  • 8,177
  • 11
  • 44
  • 54
1
vote
1 answer

How to write recursive function in MoonScript?

Is there something like arguments.callee of JavaScript for MoonScript?
wenLiangcan
  • 109
  • 1
  • 11
1
2