Is possible to read a text file and run the content as a code?
Announcement
Collapse
No announcement yet.
Read text file and run as code
Collapse
X
-
Lua 5.1 also has loadfile, which allows for a pure-Lua solution with bytecode support. TextFile.ReadToString stops the string at the first NUL char.
Code:local f, e = loadfile("myfile.lua"); if (type(f) == "function") then f(); else Dialog.Message("error", tostring(e), MB_OK, MB_ICONSTOP); end
-
👍 1
Comment
-
-
Originally posted by Imagine Programming View Post...TextFile.ReadToString stops the string at the first NUL char.
-
👍 1
Comment
-
Comment