[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Can I bind a function with callback to lua?
- From: "Leandro Candido" <enclle@...>
- Date: Sun, 27 Feb 2005 07:16:22 -0300
I will sent you a priv. mail.
God bless you,
----- Original Message -----
From: "Adam429" <email@example.com>
To: "lua" <firstname.lastname@example.org>
Sent: Friday, February 25, 2005 10:19 PM
Subject: Can I bind a function with callback to lua?
I'm a novice here. I got a problem that I want to binding a c function with callback (function pointer) to lua.The function is
first-class type in lua but it does not the same in c. Have a look of the source:
// code in c
void repeat(int time,int (*call)())
for (i=0;i<time;i++) call();
-- code in lua
function sayhello() print("Hello!\n") end
repeat(10,sayhello) -- print "Hello!" 10 times
Now I want to know how to bind the c repeat to lua. Also forgive a Chinese's poor English.
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.3.0 - Release Date: 21/2/2005