Dexter Posted August 25 Posted August 25 currently on beta `RunScript("")` always returns nil. I was kinda expecting it to return a table wrapping dofile or such, but looked at docs and saw returning boolean for if the script is ran. that is fine and useful, but if I'm running a script i'm almost always digging/updating state out after as well so it got me thinking, (here's an example of how im currently working around no bool as well): _G["results"] = nil local ret = RunScript("example.lua") -- `results = {1,2,3}` -- ret is always nil local lv = _G["results"] local set = lv ~= nil if set then -- ran ok and global pushed, go use it ... end I reckon it would be useful to return some sort of value, a table or expected value or something? or some pattern/system for getting its value or state? I assume in lua projects there is only one lua state though? If not a bool is fine too, this is a bit specific to my hotloading ui Quote
Josh Posted August 25 Posted August 25 Well, the documentation says it returns a bool. What exactly are you expecting it to return? https://www.leadwerks.com/learn/RunScript?lang=cpp In C++ the sol Lua state can be gotten with this command: https://www.leadwerks.com/learn/GetLuaState?lang=cpp Quote Let's build cool stuff and have fun.
Dexter Posted August 25 Author Posted August 25 the documentation says bool. it returns nil. never true. thats all I'll massage it in a C++ project Quote
Solution Josh Posted August 25 Solution Posted August 25 The fix will be in the next build that goes up. Quote Let's build cool stuff and have fun.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.