moonscript icon indicating copy to clipboard operation
moonscript copied to clipboard

Need nop/pass statement

Open buckle2000 opened this issue 8 years ago • 6 comments

Consider the following lua statement: for l=1,2 do end

How to perfectly translate this into moonscript? We need a statement that does nothing, like pass in Python and nop in asm. end is a perfect choice.

buckle2000 avatar Jan 18 '17 13:01 buckle2000

--pass works fine.

RyanSquared avatar Jan 18 '17 13:01 RyanSquared

while sth()
  --pass

RyanSquared avatar Jan 18 '17 13:01 RyanSquared

OK, this specific case might work, but consider this one: https://gist.github.com/buckle2000/bb2999b31706b70f767d53a8a7230661

and this one:

for l=1,2
  -- pass

buckle2000 avatar Jan 18 '17 14:01 buckle2000

You can already sort of do this:

for l=1,2
  pass

Since pass is likely undefined, that will just end up evaluating to nil. Even if it is defined, this wouldn't really do anything.

refi64 avatar Jan 18 '17 14:01 refi64

Very true, but this is somewhat unsatisfying since there is an additional statement. local _ = pass

buckle2000 avatar Jan 18 '17 16:01 buckle2000

I tend to use nil in this scenario, but it still generates the blank assignment

leafo avatar Jan 18 '17 17:01 leafo