lua-users home
lua-l archive

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


well, do not do the file.

first, use luac to compile it to bytecode
second, make the byte code a C char array and include it into your C file
third. use lua_loadbuffer to load your C string.
and last, use pcall to run it.



On 9/1/07, Александр Лейкин <leykina@gmail.com> wrote:
> Hi!
>
> Help me please.
> I'm use lua 1 month.
> How to build lua-source file to Win32-EXE file?
>
> Now, I Use Wrapper:
>
> /*--------------------------------------------*/
> #include <stdio.h>
> #include < lua.h>
> #include <lauxlib.h>
> #include <lualib.h>
>
> int main(int argc, char* argv[])
> {
> int error;
> lua_State *L = lua_open();
>
> luaL_openlibs(L);
>
> error =  luaL_dofile(L," file.lc");
>
> if(error)
> {
> printf("ERROR: %s \n", lua_tostring(L, -1));
> lua_pop(L, 1);
> }
>
> lua_close(L);
>
> return 0;
> }
> /*--------------------------------------------*/
>
> file.lc - Lua ByteCode (make with luac.exe)
>
> I want build single-exe file.
>