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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:04:53+00:00 2026-06-01T08:04:53+00:00

When key name starts with digit, in javascript we can define array-like object like

  • 0

When key name starts with digit, in javascript we can define array-like object like this:

var table = {
    '123.com': 'details'
    '456.net': 'info'
}

But when I try these code in Lua5.1:

table = { '123.com' = 'info' }

It throws an error:

[string "local"]:1: '}' expected near '='

But these code are accepted in lua:

table = {}
table['123.com'] = 'info'

I wonder if it is a bug in Lua5.1. Or did I missed something?

  • 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-01T08:04:54+00:00Added an answer on June 1, 2026 at 8:04 am

    When creating a Lua table using the literal table constructor, non-identifier table indices should be enclosed in square brackets. For example:

    table = { ['123.com'] = 'info' }

    (From: http://www.lua.org/pil/3.6.html)

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

Sidebar

Related Questions

between saving a key name like this for(var key in this.data) { var key_name
I need help on how i can specify an array name or key using
In my database I have table AnimalDetails containing animalNumber(primary key),name,breed dateofbirth and an image
In the visual studio project settings you can choose a strong name key file
I want to parse this Json code : [{id:7,key:integrationContinue:integrationContinue,name:life Portlet,scope:PRJ,qualifier:TRK,date:2012-03-26T10:10:22+0100,lname:life Portlet,lang:java,version:1.0-SNAPSHOT,description:,msr:[{key:ncloc,val:897.0,frmt_val:897},{key:coverage,val:0.6,frmt_val:0,6%}]}] I created two
Suppose you have these tables: Table Name: Salesman Fields: S_ID(Primary Key), Name Table Name:
Given the following schema: CREATE TABLE players ( id BIGINT PRIMARY KEY, name TEXT
ALTER TABLE variable ADD KEY somekey name I want to remove the line from
var myObj = {suppliers:[{name:supplier1,12m:0.08,24m:0.06}]}; alert(myObj.suppliers[0].12m); Is there a different way to get this property,
I need to create a list like List<String,Object> but I can't seem to do

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.