top of page
lua_commander.PNG

Code

Listeners and Tables in LUA

This code was written for a mod in Total War Three Kingdoms. I'm including it because I think listeners are something not really discussed in any college courses. If they are -its an after thought. 

​

Additionally I found the freedom of lua and lack of rules made it quite hard to grasp. Tables are especially weird because they can be interacted with as if they were maps or arrays, and the syntax was really hard to keep track of coming into this language. So I feel personally accomplished figuring this out and it's okay admitting the things you're confused on.

​

(shout out to Chad Vandy for the help)

Our Listener

Table used as an Array

Notice how both tables are instantiated the same way, yet used in different ways

Table_item.PNG
Array.PNG

Table used as a Map

Table_map.PNG

Note:

This also works exactly the same

NoteSame.PNG

Get The Source

bottom of page