-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Is there a reliable way to get the full path of the Lua file that called a C# method? #159
Comments
You need to overwrite Lines 79 to 129 in 157df5c
|
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 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.The text was updated successfully, but these errors were encountered: