local string = "[Legendary] Some shit"
if string.find(string, "[Legendary]") then
print("The monster is Legendary.")
else
print("The monster isn't Legendary.")
end
local string = "[Legendary] Some shit"
if string.find(string, "[Legendary]") then
print("The monster is Legendary.")
else
print("The monster isn't Legendary.")
end
LUA:local string = "[Legendary] Some shit" if string.find(string, "[Legendary]") then print("The monster is Legendary.") else print("The monster isn't Legendary.") end
local string = "[Legendary] Some shit"
if string.find(string, "%[Legendary%]") then
print("The monster is Legendary.")
else
print("The monster isn't Legendary.")
end
pls do not name the variable "string", it gets confusing when you want to use string library but then pass string as a variable name
either way that should work, the escape pattern is correct
if your monster is named [Legendary] Orc or something it should work
Well string isn't a keyword, reserved word or library, its a metatablepls do not name the variable "string", it gets confusing when you want to use string library but then pass string as a variable name
either way that should work, the escape pattern is correct
if your monster is named [Legendary] Orc or something it should work
for k, v in pairs(string) do
print(k, type(v))
end
unpack function
len function
match function
gsub function
format function
rep function
sub function
packsize function
lower function
dump function
byte function
char function
find function
upper function
pack function
reverse function
gmatch function
Well string isn't a keyword, reserved word or library, its a metatablesee :
Lua: demoLUA:for k, v in pairs(string) do print(k, type(v)) end
LUA:unpack function len function match function gsub function format function rep function sub function packsize function lower function dump function byte function char function find function upper function pack function reverse function gmatch function
My pleasureTy for code
-- an actual metatable being printed
for k, v in pairs(getmetatable("")) do
print(k, v)
end
__index table: 001D94D8
Congrats on your doodle... only took you an hour to makeit seems as if you completely forgot (or never knew in the first place) what metatables are
string is a library, which is a regular table, not a metatable (see how your code to correct me only prints out the function name and then the function address, not any metamethods)
strings themselves ("abc") have metatables set to them with __index being string so you can use methods from the string library
![]()
here's some code for you
output:LUA:-- an actual metatable being printed for k, v in pairs(getmetatable("")) do print(k, v) end
Lua: demoCode:__index table: 001D94D8
aff you got meCongrats on your doodle... only took you an hour to make![]()
what's the problem with that? o,oCongrats on your doodle... only took you an hour to make![]()