[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 04:06:38 +0000
ahh, just seen that in the title u wrote it just the right way, so i
dunno if there is a typo in ur actual code or just in ur example,
however in the worst case, u can still manually trim the shebang line
from ur scripts, but i think if lua can handle shebangs then it can do
so via the c api...
2019-05-22 3:59 GMT, szbnwer@gmail.com <szbnwer@gmail.com>:
> 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
>>
>