Open AppeazeTheCheese opened 1 year ago
You need to overwrite LuaCompileOptions
and take a look to the SandBox
-method: https://github.com/neolithos/neolua/blob/157df5c2d42da847a554ff56f4af718c39246181/NeoLua/Lua.cs#L79-L129
But is there a direct way to get the path of the file that contains the lua code that ran a specific method? Im trying to achieve the same but for completely different reason.
Im trying to make an auto script updater. My use case, the user will be able to download "modules", each as their own file and they can specify and update url. During loading of the lua file, my code should be able to find and possibly replace the file that contained the script.
No, most information is thrown away due performance reason. But you can had this with your own compiler hook. To add it before.
I am currently working on a program that allows addons written in Lua to be added to it. These addons can be shared by anyone. The idea is I would like to limit file access for these scripts so they can only read and write files in their respective addon folder as a way to prevent people from creating and sharing malicious scripts. In order for this to be done, I need to be able to get which Lua file called the current method. I tried creating a
new StackTrace()
because that's how you would accomplish this with normal C#, but as I expected this didn't yield anything useful. I also tried creating anew LuaRuntimeException()
and looking at theStackTrace
property in there, but this doesn't seem to be populated until later.