[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: function pointers in Lua
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Wed, 25 Nov 2009 14:16:45 +0100
2009/11/24 cynthia powers <powcyn@gmail.com>:
>
>
> On Mon, Nov 16, 2009 at 6:15 PM, Mark Feldman
> <mfeldman@infinite-interactive.com> wrote:
>>
>> Works for me, the problem must be elsewhere.
>>
>> === start code ===
>> function my_function()
>> print("foo")
>> end
>>
>> function function_1(my_function)
>> my_function()
>> end
>>
>> function_1(my_function) --> foo
>> === end code ===
>>
>> Mark Feldman
>>
>> cynthia powers wrote:
>>>
>>> Hi.
>>> still a Lua newbie..
>>> How do you specify function pointers in lua, and more importantly call
>>> them?
>>> This case does not seem to work for me:
>>> A.lua:
>>> function_1 (..., my_function, ..)
>>> ..
>>> while (<a function defined in c-world) do
>>> my_function()
>>> end
>>> ..
>>> end
>>> function_1 (.., my_function,..)
>>> thanks
>>> cynthia
>>
>>
>> This message and its attachments may contain legally privileged or
>> confidential information. This message is intended for the use of the
>> individual or entity to which it is addressed. If you are not the addressee
>> indicated in this message, or the employee or agent responsible for
>> delivering the message to the intended recipient, you may not copy or
>> deliver this message or its attachments to anyone. Rather, you should
>> permanently delete this message and its attachments and kindly notify the
>> sender by reply e-mail. Any content of this message and its attachments,
>> which does not relate to the official business of the sending company must
>> be taken not to have been sent or endorsed by the sending company or any of
>> its related entities. No warranty is made that the e-mail or attachment(s)
>> are free from computer virus or other defect.
>>
>
> Hi Mark,
>
> Thanks. But it still does not work for me. I have a c-calling lua-calling c
> setup. luaL_loadstring returns 3 and luaL_dostring return 1;
You should have read the manual. This would have told you that if
luaL_loadstring or luaL_dostring return a non-null integer, there is a
message describing the problem on the stack. You can access that
message with lua_tostring(L, -1). The message describes the actual
problem. If you're going to ask for further help, at least quote that
message in your email, along with the real script.