lua-users home
lua-l archive

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


On Thursday 20 January 2011 08:39:28 Michal Kottman wrote:
> On Thu, 2011-01-20 at 08:23 -0500, Steve Litt wrote:

> > You get this at runtime:
> > =================
> > slitt@mydesk:~$ ./callfunc
> > In C, calling Lua
> >
> > FATAL ERROR:
> >   lua_pcall() failed: attempt to call a nil value
> 
> This is because there is no global named "tellme" (whose value should be
> a function).

What would make tellme a global? Here's my Lua script:

=======================
function tellme()
	io.write("This is coming from lua.tellme.\n")
end

function tellme2()
	io.write("This is coming from lua.tellmetwo.\n")
end

function witharg(n)
	io.write("Number within Lua.witharg=")
	io.write(tonumber(n))
	io.write("\n")
end

print("You shouldnt see this!")
=======================

Am I missing something? I thought the existence of a non-local function called 
"tellme" within the script called by lua_pcall() would be the global function.

Thanks

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt