lua-users home
lua-l archive

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


Hi Steve Donovan and people on lua mail list,

I can answer my question #2,
>> 'samples/todo/todo.op' provides an example of using jquery in orbit.

But to test the sample I had to fix as shown below.

 - require "luasql.sqlite3"
 + luasql = require "luasql.sqlite3"

But I still want to know if I cannot use orbiter jquery library in orbit.

Thank you very much.

Journeyer Joh

----------------------------------------
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
----------------------------------------


2013/10/29 Journeyer J. Joh <oosaprogrammer@gmail.com>
Hi Steve Donovan and people on lua mailing list,

I've got a question about using 'orbiter jquery library' in 'orbit app'.
I am now implementing a web site for embedded system now using of orbit.
From my orbit app, I import jquery library like below.

local jq = require 'orbiter.libs.jquery'

But this inclusion produces error messages on a browser screen like below. (I invoked my web-site using 'wsapi --op')

(lua install prefix)/share/lua/5.1/wsapi/ringer.lua:116: (lua install prefix)/share/lua/5.1/orbiter/bridge.lua:26: attempt to index upvalue 'app' (a nil value)

FYI, let me copy the content of 'bridge.lua' below.

  1 -- Orbiter, a personal web application framework
  2 -- orbiter.orbit acts as a bridge for registering static dispatches
  3 -- that works with both Orbiter and Orbit
  4 
  5 local _M = {}
  6 
  7 local app
  8 
  9 function _M.new(app_)
 10     app = app_
 11 end
 12 
 13 function _M.dispatch_static(...)
 14     -- remember to strip off the starting @
 15     local path = debug.getinfo(2, "S").source:sub(2):gsub('\\','/')
 16     if path:find '/' then
 17         path = path:gsub('/[%w_]+%.lua$','')
 18     else -- invoked just as script name
 19         path = '.'
 20     end
 21     if orbit then
 22         local function static_handler(web)
 23             local fpath = path..web.path_info
 24             return app:serve_static(web,fpath)
 25         end
 26         app:dispatch_get(static_handler,...)    -------> This is the it.
 27         return app
 28     else
 29         local obj = require 'orbiter'. new()
 30         obj.root = path
 31         obj:dispatch_static(...)
 32         return obj
 33     end
 34 end
 35 
 36 return _M

I placed orbiter under the place shown below.

(lua install prefix)/share/lua/5.1/orbiter

#1. Is using 'orbiter jquery library' in making 'orbit web site' impossible?
#2. If it is impossible, is there any other jquery lua library I can use in making orbit web site?

Thank you very much in advance.

Sincerely
Journeyer Joh
----------------------------------------
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
----------------------------------------