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

  • SEARCH
  • Home
  • 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 1052517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:06:21+00:00 2026-05-16T17:06:21+00:00

I come from a Python background and really like the power of Python Decorators.

  • 0

I come from a Python background and really like the power of Python Decorators.

Does Lua support Decorators?

I’ve read the following link but it’s unclear to me: http://lua-users.org/wiki/DecoratorsAndDocstrings

UPDATE

Would you also mind given an example how how to implement it in Lua if it’s possible.

  • 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-05-16T17:06:21+00:00Added an answer on May 16, 2026 at 5:06 pm

    The “decorators” documented at the page you quote (and used for example in this one to add type-checking) have little to do with Python’s oddly-named “decorator syntax” for a specific way to apply a higher-order function (HOF) — rather, the decorators described and used in Lua’s wiki are a Lua idiom to support an application of the Decorator Design Pattern to Lua functions (by holding “extra attributes” — such as docstrings, typechecking functions, etc — in separate global tables).

    Lua does support HOFs (I’m not sure if you can re-bind a function name to the result of applying a HOF to the function, but you can easily, as the wiki pages show, use an anonymous “original function” and only bind a name to the HOF’s result with that anon function as the arg).

    Python’s “decorator syntax” syntax sugar is nice (and, to my surprise, seems to have increased the use of HOFs by most Pythonistas by an order of magnitude!-), but there’s nothing intrinsic or essential about them that you can’t do in Lua (and Lua’s anonymous functions run circle around Python’s goofy, limited lambda anyway — just like in Javascript, they have essentially the same power, and pretty much the same syntax, as a “normal” named function!-).

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

Sidebar

Related Questions

I'm new to Python and come from a Java background. I'd like to know
I am following a book to learn C++ (come from a python background). I've
I come from python background and am learning ruby. IPython is really awesome. I
I come from ruby/C# and am new to Python. I'm looking at the following
I come from a background of C, Fortran, Python, R, Matlab, and some Lisp
I come from a PHP background and would like to know if there's a
I'm new to Lua programming, having come over from python to basically make a
I come from a python background, where it's often said that it's easier to
I come from a PHP and Python/GAE background and am new to RoR. Typically
I come from a java background, but I'm working on a django-based website. To

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.