-
Notifications
You must be signed in to change notification settings - Fork 0
008 QuickMeta
Jeroen Broks edited this page Jan 5, 2023
·
1 revision
Script
QuickMeta Q
index
return sprintf("So you wanted to know what is in: %s",key)
end
newindex
printf("So you wanted to assign '%s' to '%s', eh?\n", value, key)
end
end
init
Q.Song = "Never gonna give you up, never gonna let you down. Never gonna run around and desert you"
print(Q.Song)
End
The program above was used to test the QuickMeta feature. QuickMeta is just a way to quickly set up a metatable. It has in no way the full support of metatables in Lua, but it covers some of the most common quick needs and makes the code look cleaner.
Currently only 'index', 'newindex', 'gc' and 'tostring' are supported. Index takes the parameter key for the used keys and newindex takes key for the keys and value for values. All of these take the variable self to refer to the table itself.
If you really need complex setups of metatables and stuff, you can still do that manually in Scyndi. You will need to check the Lua manual for the full usage of metatables documentation.