lua-users home
lua-l archive

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


Let me add one more question. (two now ^^)

As I said, I am doing this (using Orbiter's html and jquery library in Orbit App) because I want to write a jquery embedded html and the jquery contains interaction with a lua function on server side.

This was easy with Orbiter because it has convenient jquery lua library. But with Orbit, I don't know how. Especially with htmlification method doesn't seemed to be easy to mix jquery in html.

Orbit Page looked proper to do my task.

#1. Is there any known method to embed jquery in html using and without using orbit pages in orbit apps (other than my approach above)?
#2. Is there any good material which describes how to write orbit pages (Not the one in orbit homepage I've read it already)

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