Search
 
SCRIPT & CODE EXAMPLE
 

LUA

roblox difference between index and newindex

myMetaTable = {
	__index = function(table, index)
		print("Sorry, but the element ".. tostring(index).. " does not exist.")
		-- runs when you try to index a nil element of the table this metatable is connected to, table[index]
	end,
	__newindex = function(table, index, value)
		print("Sorry, but the element ".. tostring(index).. " can't be set to ".. tostring(value).. " because this element does not exist.")
		-- runs when you try to index and set a nil element of the table this metatable is connected to, table[index] = value
	end
}
Comment

PREVIOUS NEXT
Code Example
Lua :: lua destroy 
Lua :: roblox debounce 
Lua :: luau how to loop through all players 
Lua :: roblox tween color3 
Lua :: open gui script 
Lua :: forever loop in lua 
Lua :: luau table.find() 
Lua :: rotate object roblox 
Lua :: roblox pairs 
Lua :: lua create file 
Lua :: roblox destroy game script 
Lua :: for loop roblox 
Lua :: lua local 
Lua :: awesome wm tasklist disabled icon 
Lua :: shift to sprint 
Lua :: draw circle love2d 
Lua :: when do true loop on roblox lua 
Lua :: awesomewm wibar configuration transparent 
Lua :: lua how to default value if nil 
Matlab :: read all files from folder matlab 
Matlab :: matlab symbolic set value 
Matlab :: matlab find roots of symbolic polynomial 
Basic :: git token 
Basic :: wussup 
Elixir :: what is elixir language 
Elixir :: elixir string show inner binary 
Scala :: scala option 
Actionscript :: rabbitmq docker cant connect localhost 
Excel :: excel paste into multiple columns 
Perl :: perl split array into smaller arrays 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =