Search
 
SCRIPT & CODE EXAMPLE
 

LUA

roblox __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 string to number 
Lua :: luau how to make debounce 
Lua :: roblox tween color part 
Lua :: roblox how to loop through all players 
Lua :: gfjhhkn roblox 
Lua :: lua globals 
Lua :: roblox how to find value in table 
Lua :: loop true childs roblox 
Lua :: lua gsub 
Lua :: what is the point of local varaibles in lua 
Lua :: lua string count occurrence 
Lua :: lua trim 
Lua :: roblox lua wait for player to load 
Lua :: lua f animation 
Lua :: What is The Color changing script for luaa 
Lua :: how to make variables in lua 
Lua :: check if player is in group 
Lua :: lua prin type of variable 
Lua :: lua table concanation 
Matlab :: matlab font size axis 
Matlab :: count even and odd numbers in matlab 
Matlab :: alternative from two vectors matlab 
Basic :: personal access token 
Basic :: dos assign command output to variable (when output is of multiple lines) 
Elixir :: hello world in elixir 
Elixir :: elixir comparison 2 different data types 
Scala :: scala pattern matching 
Actionscript :: how to take value only from the checked checkbox 
Excel :: excel paste across cells 
Perl :: how to launch a perl script 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =