This adds support for LUA, what it does is add events (which moonsharp can access and add/remove from/to). The link for how to is here. This has no effect on current code.
To add lua functions to the events is really easy, you just have to implement an InitializeLUA function by adding the key LUAInitializeFunction and the value being your function name as a custom parameter. It will then call it upon initial load and you can assign yourself to the function just by doing function.add(myFunction) you can also fire it just as normal.
This will however not give you access to the initialize object command, this is mainly just to keep the whole thing smooth and simple since already each event has to be done on implementation and not base due to how we implement mods. So it really is only build for small changes and you can't create custom objects, a good example would be that if you wanted to implement a button to toggle fullscreen you would use LUA where as you would use C# for a dropdown of all resolutions, or something that doesn't fit nicely into the generics.
There is an example in this build for the DevMode. Note: you have to use Settings.GetSetting(string key) -> string to get the setting, the whole caching is really only for C# since we can do a full object implementation rather than a partial function one as in LUA.
Closes https://github.com/TeamPorcupine/ProjectPorcupine/issues/1792
This adds support for LUA, what it does is add events (which moonsharp can access and add/remove from/to). The link for how to is here. This has no effect on current code.
To add lua functions to the events is really easy, you just have to implement an InitializeLUA function by adding the key
LUAInitializeFunction
and the value being your function name as a custom parameter. It will then call it upon initial load and you can assign yourself to the function just by doingfunction.add(myFunction)
you can also fire it just as normal.This will however not give you access to the initialize object command, this is mainly just to keep the whole thing smooth and simple since already each event has to be done on implementation and not base due to how we implement mods. So it really is only build for small changes and you can't create custom objects, a good example would be that if you wanted to implement a button to toggle fullscreen you would use LUA where as you would use C# for a dropdown of all resolutions, or something that doesn't fit nicely into the generics.
There is an example in this build for the DevMode. Note: you have to use
Settings.GetSetting(string key) -> string
to get the setting, the whole caching is really only for C# since we can do a full object implementation rather than a partial function one as in LUA.