Skip to content
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

Lua Run File Doesnt Work #25

Open
kstzl opened this issue Apr 17, 2021 · 10 comments
Open

Lua Run File Doesnt Work #25

kstzl opened this issue Apr 17, 2021 · 10 comments

Comments

@kstzl
Copy link

kstzl commented Apr 17, 2021

Hello, lua run file doesnt seem to work :

image
image
image

It say nil :/

@kstzl
Copy link
Author

kstzl commented Apr 17, 2021

And also, how to call an UFunction from lua with parameters ? Thx

@rdeioris
Copy link
Owner

Hi, LuaRunFile does not run code assets, it runs plain files from the filesystem. To run UFunction you need to register them in the LuaState using LuaValue as arguments

@kstzl
Copy link
Author

kstzl commented Apr 17, 2021

Oh ok, but so, we cant "RunLuaFile" with a .lua in project ?

@kstzl
Copy link
Author

kstzl commented Apr 17, 2021

Also, i removed some functions in my lua script but they seems to be always here

@rdeioris
Copy link
Owner

You can have .lua files in the content directory but they are completely different from LuaCode Assets. Read: you cannot change the LuaCode asset and expect the .lua file will be changed accordingly, they serves different purposes (one allows after-builds modifications, the other will be hardcoded in the final binary).
If you want to edit scripts from Unreal itself, just do not use lua files, but only LuaCode Assets and use LuaRunCodeAsset to load/parse/execute them.

@kstzl
Copy link
Author

kstzl commented Apr 17, 2021

Oh ok, i see thank you, and like i said, i had functions (but i removed it, in the .lua) and the lua stack continue executing it, whats the problem ? I think lua memorized my functions

@rdeioris
Copy link
Owner

It is in the previous answer :) you are changing the code asset instead of the lua files, or (but i doubt about it) you are expecting that just changing the content of the file will be enough for lua (you need to reparse/execute it, you can re-run LuaRunFile or LuaRunCodeAsset multiple times for the same LuaState)

@kstzl
Copy link
Author

kstzl commented Apr 17, 2021

Oh ok sorry i didnt see ! I will check, thank you :)

@kstzl
Copy link
Author

kstzl commented Apr 17, 2021

LuaRunCodeAsset doesnt resolve the problem
LuaRunFile dont found my file..
Ouch :/

@kstzl
Copy link
Author

kstzl commented Apr 17, 2021

Ok i figured out the "problem", i was calling a function that doesnt exist in my .lua file
BUT i was expecting that lua dont care about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants