lua-users home
lua-l archive

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


Hello,

I am now writing a web service using orbit.

While doing this a call to a extended api prints out error message below.

/home/g2c/rest/share/lua/5.1/wsapi/ringer.lua:116: ./ics.lua:23: attempt to call global 'attach' (a nil value)

And the code that generated this error is shown below.

  1 #!/usr/bin/env wsapi.cgi
  2 
  3 require "orbit"
  4 require "orbit.cache"
  5 
  9 module("ics", package.seeall, orbit.new)
 10 
 22 -- Initializes variables and these variables are Model
 23 addr = attach(9527, 1024, 1)

You can find the line #23, which generated the very error.

23 addr = attach(9527, 1024, 1)

I invoked orbit webservice like below.

wsapi --op

But if I launched the same web service like below,

orbit ics.lua

No error appears!!

I need to verify one thing.
The api "attach()" is defined in lua.c like below.

int my_attach(lua_State *L)
{
 ...........
}
static int pmain (lua_State *L) {
    ...................
    lua_pushcfunction(L, my_attach);
    lua_setglobal(L, "attach");
    ....................
}

#1. I'd like to know the difference between those two below.

wsapi --op

  and 

orbit ics.lua

#2. How can I make my code access extended lua api, attach() with below?

wsapi --op


And there is another difference between those two.

href = "" media = 'screen'

This code shows different behaviors depending on how the orbit web service is invoked.
So,

#3. Why this code behaves differently depending on how orbit is invoked?

Thank you very much in advance.

Sincerely
Journeyer
from Seoul
----------------------------------------
Journeyer J. Joh
o o s a p r o g r a m m e r
a t
g m a i l  d o t  c o m
----------------------------------------