Announcement

Collapse
No announcement yet.

Read text file and run as code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Centauri Soldier
    replied
    Originally posted by Imagine Programming View Post
    ...TextFile.ReadToString stops the string at the first NUL char.
    I didn't realize that, good catch.

    Leave a comment:


  • Imagine Programming
    replied
    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

    Leave a comment:


  • Centauri Soldier
    replied
    local sFile = TextFile.ReadToString("myfile.lua");
    local fCode = loadstring(sFile);

    if ( type(fCode) == "function" ) then
    fCode();
    end

    Leave a comment:


  • gutierrez100
    replied
    herrin many thanks

    Leave a comment:


  • herrin
    replied
    Code:
    autoplay media studio > help > [B]dofile[/B]


    Leave a comment:


  • gutierrez100
    started a topic Read text file and run as code

    Read text file and run as code

    Is possible to read a text file and run the content as a code?
Working...
X
😀
🥰
🤢
😎
😡
👍
👎