![]() Really come into its own until you combine tables with closures, so Tables can also serve as very simple objects, but Lua OOP doesn't And even cooler, unlike C, with Lua tables youĬan add elements to the struct at runtime.īecause Lua's syntax is so much easier than other languages, you canīuild up a huge data structure using tables, and that data structure the key is the struct's element name, and the value is the value of Well guess what - you can use a table to do all of that And what do you get when you bundleĭata and functions together? You get an object.Įach field could represent an integer, a string (pointer to char), anĪrray, another struct, a pointer to another struct, or even a pointer ![]() So unlike Perl, PythonĪnd Ruby, with Lua it's efficient to use a table as an array.Īnd because functions are just data, it's perfectly reasonable to use aįunction as one value in a table. ![]() But Lua is built from the ground up to be fastĪnd efficient with its tables. Think hashes in Perl and Ruby orĭictionaries in Python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |