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 8496425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:51:06+00:00 2026-06-10T23:51:06+00:00

What is the syntax to create the function, but then add it’s implementation further

  • 0

What is the syntax to create the function, but then add it’s implementation further down in code?

So roughly like this:

  • Define function doX
  • Call doX (further down in the code)
  • doX implemention (i.e. all functions down at the bottom of the file)
  • 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-10T23:51:08+00:00Added an answer on June 10, 2026 at 11:51 pm

    oh…so there’s really no way to call funcName prior to having actually defined the function then? i.e. you still need to make sure defineIt is called before your first call to funcName itself?

    I wanted to clarify this point, and I felt that an answer would be the better way than a comment.

    Lua is a much simpler language than C or C++. It is built on some simple foundations, with some syntactic sugar to make parts of it easier to swallow.

    There is no such thing as a “function definition” in Lua. Functions are first-class objects. They are values in Lua, just like the number 28 or the string literal "foo" are values. A “function definition” simply sets a value (namely, the function) into a variable. Variables can contain any kind of value, including a function value.

    All a “function call” is is taking the value from a variable and attempting to call it. If that value is a function, then the function gets called with the given parameters. If that value is not a function (or a table/userdata with a __call metamethod), then you get a runtime error.

    You can no more call a function that hasn’t been set in a variable yet than you can do this:

    local number = nil
    local addition = number + 5
    number = 20
    

    And expect addition to have 25 in it. That’s not going to happen. And thus, for the same reason, you can’t do this:

    local func = nil
    func(50)
    func = function() ... end
    

    As Paul pointed out, you can call a function from within another function you define. But you cannot execute the function that calls it until you’ve filled in that variable with what it needs to contain.

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

Sidebar

Related Questions

I want to create one proc like below but it has error on syntax.
I'm having troubles with a syntax error when trying to create a function in
Like Oracle, SQL Server supports parameter defaults in stored procedures. Oracle syntax: CREATE OR
If a create a in-memory sqlite database using syntax below, then what is the
I would like to create a virtual table with a similar syntax SELECT 'sk:
I want to create a capped collection from Java code. I found the syntax
I'm attempting to create a div tag and then alter it via css, but
Can anyone give me a clue, how to create/call function regular expression syntax in
I'm trying to create this function: CREATE FUNCTION remove_non_alphanum (prm_strInput varchar(3000)) RETURNS VARCHAR(3000) DETERMINISTIC
I've seen this function in this link: http://www.artfulsoftware.com/infotree/queries.php#552 CREATE FUNCTION levenshtein( s1 VARCHAR(255), s2

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.