Skip to content
  • Fight Night
  • Server Release
  • Testing Sessions
  • Server Rules (All Servers)
  • (In) Territory Laws
  • City Laws
  • Drained Server Rules
  • Devastated Server Rules
  • Little Creek Server Rules
  • In For A Penny Server Rules
Territory

Territory

Western RP with a Twist

  • Calendar of Events
  • FAQ’s
  • Tutorials
  • Contact Staff
  • Server List
  • Server Rules (All Servers)
  • Toggle search form

bad argument #1 to ‘insert’ (table expected, got nil)

Posted on December 26, 2022March 18, 2023 By Crimson Creek Team

What does “SCRIPT ERROR: bad argument #1 to ‘insert’ (table expected, got nil)” mean?

Look at the script at that like you will find something like this:

table.insert(table_name, data_to_insert)

The error means that the varaible that you are passing into the function “table_name” is nil instead of a table.

Causes?

You haven’t declared your variable correctly, so it doesn’t exist. This could be you forgot to create it at all, or it could be you have a timing issue where it is created in a thread elsewhere in your code, and this function is being called to early.

The table_name is being returned as part of a db query or a nui response, and the returned results are nil. In this case you need to look at the functions or nui that are returning data to the lua script. Figure out what they are returning and why it is nil.

Crimson Creek Team

Crimson Creek Team, a group of volunteers working together to have a good time RPing and running our servers.

See author's posts

Hits: 10

Uncategorized

Post navigation

Previous Post: How do I make an event? Redm/CFX/LUA
Next Post: Macabre Brooches

Related Posts

Tutorails for Redm, CFX, or Vorp Blog – RedM – Crimson Creek Project Blog
Interiors – Emerald Ranch Bar Uncategorized
Welcome to Crimsion Creek Territory! Blog

Newsletter



Holiday Events

There are no upcoming events.

Archive

  • May 2023
  • April 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022

Donations

Patreon

Kofi

There are no upcoming events at this time

June 2023
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930  
« May    

Copyright © 2023 Territory.

Powered by PressBook Masonry Dark

Loading...
 

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.