[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_loadbuffer API does not deal with the buffer from a file that started with '#!'
- From: "szbnwer@..." <szbnwer@...>
- Date: Wed, 22 May 2019 03:59:20 +0000
hi there! :)
i think u need this:
#!/usr/bin/lua
(note the "!")
otherwise ive never played with the c api, but for a 2nd shot i'd try
the same without the whole 1st line. if none will do the trick, then
others will help :D
good luck and the like! :)
2019-05-22 1:29 GMT, Baozeng <sploving1@gmail.com>:
> Hello all,
> The last email is not show normally. so I send again.
> I have a simple Lua file, for example, hello.lua. The contents of the file
> is as the following:
>
> #/usr/bin/lua
> print('hello')
>
> I first read the file content into a buffer. And then use luaL_loadbuffer
> to load the buffer and finally use lua_pcall to call the function. However,
> I have found that luaL_loadbuffer cannot return 0 because it does not deal
> with this case.
>
> Do you think this is a feature missing? If it does, I would like to commit
> the code to deal with that.
> Thank you.
>
> Baozeng <sploving1@gmail.com> 于2019年5月22日周三 上午9:19写道:
>
>> Hello all,
>> I have a simple Lua file, for example, hello.lua. The contents of the
>> file is as the following:
>>
>> #/usr/bin/lua
>> print('hello')
>>
>> I first read the file content into a buffer. And then use
>> luaL_loadbuffer
>> to load the buffer and finally use lua_pcall to call the function.
>> However,
>> I have found that luaL_loadbuffer cannot return 0 because it does not
>> deal
>> with this case.
>>
>> Do you think this is a feature missing? If it does, I would like to
>> commit
>> the code to deal with that.
>> Thank you.
>>
>> --
>> Best Regards,
>> Baozeng Ding
>>
>>
>
>
> --
> Best Regards,
> Baozeng Ding
>