Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8271669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:54:28+00:00 2026-06-08T06:54:28+00:00

I have this valid CoffeeScript and wish to convert it to LiveScript. Can someone

  • 0

I have this valid CoffeeScript and wish to convert it to LiveScript. Can someone explain why it fails to convert? Also to give a converted one?

TodoCtrl = (scope) ->
  scope.addTodo = ->
    scope.todos.push
      text: scope.todoText
      done: false
    scope.todoText = ''

You can use this to compile CoffeeScript.

http://coffeescript.org/

You can use this to compile LiveScript.

http://gkz.github.com/LiveScript/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:54:29+00:00Added an answer on June 8, 2026 at 6:54 am

    You are calling the function scope.todos.push against an implicit block starting with an implicit object. You must use do in LiveScript, as it does’t do this special case (just think of do as parentheses around the block). See https://github.com/gkz/LiveScript/issues/50 for reasons.

    The code you want:

    TodoCtrl = (scope) ->
      scope.addTodo = ->
        scope.todos.push do
          text: scope.todoText
          done: false
        scope.todoText = ''
    

    which is equivalent to (ie do is just parentheses)

    TodoCtrl = (scope) ->
      scope.addTodo = ->
        scope.todos.push(
          text: scope.todoText
          done: false
        )
        scope.todoText = ''
    

    Glad to see you using LiveScript!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a feeling this XML is not valid, can someone please explain why?
Right now I have this SQL query which is valid but always times out:
Is this a valid http url http://www.example.com?x&y or we must always have = sign
I have a valid reason for wanting to do this, but it's a long
Thanks for looking on this problem. I have a page that is totally valid
I have this string 2012-06-27 16:17:06 and I want to convert it to GMT
I have this valid query (in .Net4.0) that gets the still-open invoices: Dim dinvs
Is this valid dbo.dbo , if so what does it mean? I have spoted
Is this valid CSS for browser reset? What does it do? I have been
I have this HTML code fragment (in a valid document using strict doctype): <p>Without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.