[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using part of a Lua script from C
- From: Wesley Smith <wesley.hoke@...>
- Date: Mon, 3 Aug 2009 21:59:41 -0700
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")
--internal functions:
function internal1() end
function internal2() end
--function called by C/C++:
function filter(a,b)
internal1()
internal2()
end
--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