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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:23:30+00:00 2026-05-31T10:23:30+00:00

i try to integrate Lua in a embedded project using GCC on a Cortex-M4.

  • 0

i try to integrate Lua in a embedded project using GCC on a Cortex-M4. i am able to load and run a Lua script, calling Lua functions from C, calling C functions from Lua. but the C program crashes (HardFault_Handler trap rises) when the given script passed as parameter in luaL_dostring() contains any Lua syntax errors.

here the relevant C code that crashes due to the syntax error in Lua:

      //create Lua VM...
      luaVm = lua_newstate(luaAlloc, NULL);

      //load libraries...
      luaopen_base(luaVm);
      luaopen_math(luaVm);
      luaopen_table(luaVm);
      luaopen_string(luaVm);

      //launch script...
      luaL_dostring(luaVm,  "function onTick()\n"
                            "  locaal x = 7\n"  //syntax error
                            "end\n"
                            "\n" );

when doing the same with correct Lua syntax, then it works:

  luaL_dostring(luaVm,  "function onTick()\n"
                        "  local x = 7\n"  
                        "end\n"
                        "\n" );

when debugging and stepping through luaL_dostring(), i can follow the Lua parsing line for line, and when reaching the line with the syntax error, then the C program crashes.

can anybody help? thanks.


have disabled setjmp/longjmp in Lua source code in the following way:

//#define LUAI_THROW(L,c)    longjmp((c)->b, 1) //TODO oli4 orig
//#define LUAI_TRY(L,c,a)    if (setjmp((c)->b) == 0) { a } //TODO oli4 orig

#define LUAI_THROW(L,c)    while(1) //TODO oli4 special
#define LUAI_TRY(L,c,a)    { a }    //TODO oli4 special

…so there is no setjmp/longjmp used anymore, but i still have the crash 🙁

must have another cause???

  • 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-31T10:23:31+00:00Added an answer on May 31, 2026 at 10:23 am

    found the problem: it is the sprintf function called on Lua syntax error. in fact, on my platform sprintf seems not support floating point presentation. so i changed luaconf.h the following way, limiting the presentation to integer format.

    //#define LUA_NUMBER_FMT     "%.14g"
    #define LUA_NUMBER_FMT     "%d" 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to integrate django-ifs like a django app without using buildout. Now I
I just try to integrate ImageMagick into my PHP project. I installed and just
I am try to create Phonegap project in which i need to integrate ASIHTTPRequest
I'm trying to integrate posting to one's wall from within my app.i try this
I try to integrate paypal with Android app using sandbox. I'm getting successfully longing
I am trying to integrate an openID login in a ZF project (using the
I am using Primefaces-2.1 now, I try to integrate Richfaces-3.3.3 in my application in
I was trying all of yesterday to try and integrate a SQL Database with
Try as I might, I can't get a JNLP file to run locally (via
I want to try and integrate my rdf data which is in an .rdf

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.