Lua function not being accepted
Moderator: Forum Moderators
- Lord-Knightmare
- Discord Moderator
- Posts: 2364
- Joined: May 24th, 2010, 5:26 pm
- Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
- Contact:
Lua function not being accepted
Hello,
I have this Lua function which is not being accepted by the
What am I doing wrong in the Lua function such that I keep getting this error?
This is where I got the example
I have this Lua function which is not being accepted by the
lua_function=
key and this generates the following error:
LuaWML code
This is where I got the example
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Re: Lua function not being accepted
Where did you put the
[lua]
tag? In the Simple Attack MAI test scenario (which is where the code example on the wiki comes from) it's in a preload event.SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
- Lord-Knightmare
- Discord Moderator
- Posts: 2364
- Joined: May 24th, 2010, 5:26 pm
- Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
- Contact:
Re: Lua function not being accepted
Oh, that solved it! Thank you! Initially, I had assumed that including it in the prestart event would have made it available but seemsmattsc wrote: ↑February 6th, 2021, 7:11 pm Where did you put the[lua]
tag? In the Simple Attack MAI test scenario (which is where the code example on the wiki comes from) it's in a preload event.
[lua][/lua]
only works in preload, or inside a [filter_condition]
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Re: Lua function not being accepted
In principle it should work in a prestart event, I think, but then it will be lost if you start from a not-start-of-scenario save.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
- Celtic_Minstrel
- Developer
- Posts: 2222
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Lua function not being accepted
[lua]
works in any event, but if it's defining something that needs to be available globally, then it needs to be in preload.