lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 08/03/2009 21:59, Wesley Smith wrote:
Obviously you could do some basic string matching on the script to
clip it to the appropriate length.  You could also do something pretty
basic like:

// in C
lua_pushboolean(L, 1);
lua_setglobal(L, "global_var_set_by_app")
...
--code to allow the script to run stand-alone:
if(not global_var_set_by_app) then
    a = 1
    b = 2
    filter(a,b)
end

Processing the script to remove any non-functions was my original thought; I wanted to be sure I wasn't missing any easier fix. I like the if (not...) idea too, especially for development and testing.

For "production", though (whatever that ends up being), explicitly preventing execution by extracting only the functions looks like the ultimate solution.

I appreciate your help. Thanks, too, to Hans Elbers and Jerome Vuarand for their variations of the "am-I-standalone" test idea.

-evan