richardhundt / shine

A Shiny Lua Dialect
Other
231 stars 18 forks source link

great work #72

Closed miketang84 closed 6 years ago

miketang84 commented 9 years ago

I use lua and luajit some years, glad to see your work, I'll try it.

Did you use Shine in your commercial project?

Thank you.

miketang84 commented 9 years ago

and how about the driver in Shine to dbs, such as redis, postgresql, mongodb? Use lua? or Shine has its' own wrapper?

richardhundt commented 9 years ago

Hi, thanks for your interest.

Did you use Shine in your commercial project?

I use Shine for a couple of projects, one of which was intended as a commercial product, but I wouldn't say that it is mature and stable enough for large scale use. However, if more people do use it and give me bug reports, the it will get better.

and how about the driver in Shine to dbs, such as redis, postgresql, mongodb? Use lua? or Shine has its' own wrapper?

If your data store has a REST API then it's relatively easy to create a REST client, or you can use something based on: https://github.com/richardhundt/swarm/blob/master/lib/swarm/rest/init.shn

For everything else, Lua modules work just fine. You can require a Lua module just as you would in Lua.

miketang84 commented 9 years ago

is there missing some main features yet? like Timer.

miketang84 commented 9 years ago

and, if i use a third party library based on luasocket, how to cooperate with Shine's async feature?

richardhundt commented 9 years ago

is there missing some main features yet? like Timer.

The event loop has a timer watcher, but I fixed the async.timer.Timer class which wraps it now too.

and, if i use a third party library based on luasocket, how to cooperate with Shine's async feature?

On *nix you can call getfd() to get a luasocket file descriptor and create a Shine async.loop.Poller from that:

import Poller from "async.loop"
poller = Poller your_luasocket.getfd(), Poller::POLLIN, (poll, evts) =>
   -- handle the event
end

Have a look at https://github.com/richardhundt/shine/blob/master/lib/async/io.shn#L84 to get an idea of how it works. You could wrap a luasocket socket in a class which includes AsyncStream to get the fiber cooperation. Depends what you want to do.