User Tag List

Results 1 to 4 of 4

Thread: Lua Eval

  1. #1
    No Products Registered

    Join Date
    Aug 2006
    Location
    Westcountry, UK
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lua Eval

    In javascript there is an eval() function that changes a string to an expression such as eval("alert('hi')") which triggers an alert.

    I'm trying to find a way of doing the same in lua. I've tried using _G[x] but this doesn't work for table values (e.g x = "a.b") or functions.

    Any suggestions would be much appreciated thanks!

  2. #2
    No Products Registered

    Join Date
    Aug 2006
    Location
    Westcountry, UK
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Lua Eval

    I've managed to find a suitable answer:

    Register "raweval" in MMF2

    On "raweval" Run string "e = " + MMF2StringParameter(1)

    And in lua..

    Code:
    function eval(a)
    raweval(a)
    return e end

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Lua Eval

    That sounds dangerous.

    EDIT: That's a reply to your original post, not your solution, which is innovative, though I still can't see the need for it.

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,741
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Lua Eval

    loadstr() in lua does the same as eval() in javascript, php etc.

Similar Threads

  1. Alt Val A of edit box does not seem to eval
    By Kimera in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 24th October 2007, 03:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •