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, 2022December 26, 2022 By Crimson Creek Team No Comments on bad argument #1 to ‘insert’ (table expected, got nil)

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

Related Posts

Tutorails for Redm, CFX, or Vorp Blog – RedM – Crimson Creek Project Blog
Welcome to Crimsion Creek Territory! Blog

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


Newsletter



Holiday Events

There are no upcoming events.

Archive

  • 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

February 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728  
« Dec    

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.