Page 1 of 1
How to use Lua scripts
Posted: Fri Oct 19, 2018 2:42
by FranchuFranchu
Now Lua can be used in TheoTown. Lua is a real proggraming language. To learn it, read
this.
To include a Lua file in your plugin, use this:
The file has to be in the same directory as your JSON.
The Lua code can be this:
Code: Select all
function script.nextMonth()
Debug.toast("Hello Month!")
end
This will show a toast each month.
The full list of the available functions in TheoTown is in
https://theotown.com/forum/viewtopic.php?f=41&t=8587.
Re: How to use Lua scripts
Posted: Fri Oct 19, 2018 6:52
by Mg3094066
FranchuFranchu wrote: ↑Fri Oct 19, 2018 2:42
Now Lua can be used in TheoTown. Lua is a real proggraming language. To learn it, read
this.
To include a Lua file in your plugin, use this:
The file has to be in the same directory as your JSON.
The Lua code can be this:
Code: Select all
function script.nextMonth()
Debug.toast("Hello Month!")
end
This will show a toast each month.
The full list of the available functions in TheoTown is in
https://theotown.com/forum/viewtopic.php?f=41&t=8587.
Ummm... What does the Lua test?
Re: How to use Lua scripts
Posted: Fri Oct 19, 2018 12:04
by FranchuFranchu
It shows a toast each month
Re: How to use Lua scripts
Posted: Thu Oct 25, 2018 18:29
by ElephantEthan
• Do lua scripts need a building to function? (like fun functionality)
• Can lua scripts be attached to anything? (buildings, terrain, trees, cars)
• How would one make a script that replaces a grass tile with a sand tile?
Re: How to use Lua scripts
Posted: Thu Oct 25, 2018 20:07
by CommanderABab
Probably not; sure, why not; why not a sand dune blowing in the wind?
Re: How to use Lua scripts
Posted: Thu Oct 25, 2018 20:08
by CommanderABab
Yay! A triple negative sentencs!
Re: How to use Lua scripts
Posted: Thu Oct 25, 2018 20:24
by ElephantEthan
CommanderABab wrote: ↑Thu Oct 25, 2018 20:08
Yay! A triple negative sentencs!
Your post contains so much negativity that it's actually positive

although I'm not sure if I understand the land one.
Re: How to use Lua scripts
Posted: Fri Oct 26, 2018 19:23
by ElephantEthan
Alright, I attached a script to an animation and it works, even if I didn't use the animation. I got the script to run when you open the game. Really cool stuff!
Re: How to use Lua scripts
Posted: Tue Nov 06, 2018 1:28
by TheRetroGuy
Is it possible to have a Lua app on mobile?
Re: How to use Lua scripts
Posted: Tue Nov 06, 2018 2:03
by CommanderABab
Re: How to use Lua scripts
Posted: Thu Nov 08, 2018 13:29
by Ølsken
To be honest I don't like any of the apps that are available
In the store. Rather use a PC or just use a normal text editor that supports Lua (
i.e. QuickEdit)