Totally noob question regarding LUA

hitom3

Chieftain
Joined
Nov 6, 2018
Messages
1
Hi! I'm trying to test my FireTuner and i want to start practicing LUA, but so far with no success.
I've tried the code

Code:
function test(iPlayer)
   local pPlayer = Players[iPlayer];  
   if (pPlayer ~= nil) then  
       if (not pPlayer:IsMinorCiv() and pPlayer:GetNumCities() == 1) then  
           print("Lol")  
       end  
   end
end
GameEvents.PlayerCityFounded.Add(test)


So the concept behind this is it should print "Lol" if I build my first city. But i see "Lol" nowhere!! Not even on my FireTuner or in lua.log or anywhere.

Am i doing something wrong??
 
Have you set up the correct file imports (InGameUIAddin for these kind of Lua files)? (https://forums.civfanatics.com/thre...t-vfs-ingameuiaddin-or-updatedatabase.487846/)
(What I usually do is also add a small print-message at the top of my file. This way, I can ensure that my file loads correctly!)

P.s. The FireTuner will show the exact same things as Lua.log. The main difference is that you can actually see the FireTuner update in real time, whereas you'd need to re-open Lua.log in order to view the updates.
 
Back
Top Bottom