Page 1 of 1
How to use Lua scripts
Posted: 19 Oct 2018, 02: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: 19 Oct 2018, 06:52
by Mg3094066
FranchuFranchu wrote: ↑19 Oct 2018, 02: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: 19 Oct 2018, 12:04
by FranchuFranchu
It shows a toast each month
Re: How to use Lua scripts
Posted: 25 Oct 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: 25 Oct 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: 25 Oct 2018, 20:08
by CommanderABab
Yay! A triple negative sentencs!
Re: How to use Lua scripts
Posted: 25 Oct 2018, 20:24
by ElephantEthan
CommanderABab wrote: ↑25 Oct 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: 26 Oct 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: 06 Nov 2018, 01:28
by TheRetroGuy
Is it possible to have a Lua app on mobile?
Re: How to use Lua scripts
Posted: 06 Nov 2018, 02:03
by CommanderABab
Re: How to use Lua scripts
Posted: 08 Nov 2018, 13:29
by Bearbear76
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)
Re: How to use Lua scripts
Posted: 22 Dec 2019, 14:04
by Hadestia
Its like a java
Re: How to use Lua scripts
Posted: 23 Dec 2019, 02:08
by Bearbear76
rjroldan1 wrote: ↑22 Dec 2019, 14:04
Its like a java
Not really like Java.
Compared to java Lua is much more forgiving and easy.
Re: How to use Lua scripts
Posted: 23 Dec 2019, 17:08
by JustAnyone
Also 10x slower.
Re: How to use Lua scripts
Posted: 24 Dec 2019, 00:03
by Bearbear76
Lua is still on the fast side though