• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved How to insert value into table?

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,758
Solutions
127
Reaction score
2,277
Hello, I have problem with inserting values to table...
I have table:
Code:
local t = {}
and I want to insert value into this table as following:
Code:
local t = {
{text = "xxxx"}
}

I'm trying:
Code:
table.insert(t, {text = "xxxx"})

but it does not work for me...
 
Last edited:
dont use table.insert, just use
Code:
t[#t+1] = value
or
t[12309412903] = value
also
Code:
local t = {}
table.insert(t, {text = "xxxx"})
print(t[1].text)
works perfectly fine on any lua interpretor, you're doing something wrong
 
dont use table.insert, just use
Code:
t[#t+1] = value
or
t[12309412903] = value
also
Code:
local t = {}
table.insert(t, {text = "xxxx"})
print(t[1].text)
works perfectly fine on any lua interpretor, you're doing something wrong

what if im inserting more than one value?
for example:
if storage then
insert,value(t,{text = "xxx1"})
elseif storage2 then
insert.value(t,{text = "xxxx2"})
 
nvm, looks like its working now.
It didnt work with local function() and addEvent lol
 
Back
Top