VC and Lua are quite different.
The most obvious difference will be the syntax and features of the language. In VC, you declare variables and functions with their type, use preprocessor #define and #includes, and have copious amounts of semi-colons and curly braces. Arrays have fixed size, memory must be manually created and freed, arrays and structs can't be declared in functions, so almost all things are integers and text strings.
But in Lua, this is changed. The syntax is a bit strange at first but you get used to it, lots of "if ... then" "do" and "end" like things. Functions and variables can be used practically anywhere, and the types of things that can change during runtime. In fact, functions are values and can be returned from functions or reassigned at will. Reading over the Lua language reference manual is recommended.
Aside from language differences, the built-in library actually shares some commonality. For the most part it is the exact same in how it's used, but with a few differences:
- All built-in library variables and functions are contained in a table called v3.
- Built-in variables and functions that use 0/1 to indicate truth values, use Lua's boolean type (true/false) instead. For example, v3.ImageValid(image), v3.FileEOF(file), v3.key[scan].
- Collections of structures have like entity.x in VC have become v3.entity.x in Lua. Basically the array comes before the attribute now. This applies to entity, sprite, layer, and zone variables, and possibly others.
There are also some library additions for convenience/performance sake:
- For variables, there are raw getter/setter functions in v3. These are faster than the usual variable accesses, but throw away some safety.
- getters are prefixed with get_
- setters are prefixed with set_
- all dots . in a variable name are replaced with underscores _ for the function name
- for setters, the last (and possibly first) argument to the function is its new value.
- for getters/setters of array-type variables, the first parameter is the index.
- the function name is fully lowercase
- Examples: v3.get_entity_x(1); v3.set_layer_lucent(0, 50); v3.get_timer()
- For fields that are represented as a #define in VC, their value is stored in the v3 table directly instead of having a getter.
- v3.GCHandle(int handle, string destructor) is a helper function that will create a garbage collected wrapper of a built-in handle type, that calls v3[destructor](handle) on collection (when no variables refer to the handle anymore). This makes it possible to have auto-freed images, fonts, sounds, and other things.
If you want a library that really improves your workflow for Lua in Verge, try the vx library, which restructures Verge's functionality to be more organized and object-oriented, and adds in helpful things like garbage-collection.