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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:41:47+00:00 2026-06-08T09:41:47+00:00

I am wanting to code mappings in Lua rather than in C for the

  • 0

I am wanting to code “mappings” in Lua rather than in C for the simplicity and beauty of Lua 😉

So lets say in C I could have had the following:

typedef struct my_struct{
    char field_1[10];                              
    char field_2[250];                                
    char field_3[2000];                              
}my_struct;

my_struct   *pmy_struct;

pmy_struct = (my_struct *) some_buffer;

So I am wanting a way in Lua to have FIXED lengths on fields inside a “structure” so that the overall BUFFER OFFSETS stay in tact when it reaches the target system….

So lets say in the above struct I wanted to set “field_3” to the text “apple”……I still want that structure field to have an overall length of 2000 bytes…

  • 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-08T09:41:49+00:00Added an answer on June 8, 2026 at 9:41 am

    Lua doesn’t work that way. Lua does not have “structures”. It does not have “fields” which have “sizes”.

    It has tables, which can have values of several different types. These values are mapped to keys (which are themselves values). While you can use metatables to prevent the addition of new keys, you can’t force the “size” of a value to be anything in particular.

    Or, to put it another way, stop trying to program Lua like it’s C. They are different languages, and you should approach each language in its own way. In C, you want to care about the size of fields, the layout of structs, etc.

    The reason to use Lua (and most scripting languages) is because you don’t want to care about those things. You don’t want to care if the string “apple” happens to be stored in a byte array 2000 bytes in size. And if you want to care about that, then you don’t want to use Lua.

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

Sidebar

Related Questions

I have the following code: int i = 5000; Console.WriteLine(waiting + i + miliseconds);
Wanting to integrate aspects of SharePoint into an existing website - rather than integrating
Ok, Wanting to MVVM an existing app. The code behind contains the following: private
For example, lets say I have a page and 2 custom controls on that
I have the below code that i am wanting to into certain files so
I have the source code for the VersionOne plugin. I am wanting to modify
I have the following code that allows me to position it on the top.
I am wanting to code something with OpenGL, but I don't want to have
I have the following code that confirms a activation with the database. What I
I am wanting to alter the following php code so that it resizes and

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.