lua-users home
lua-l archive

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


It was thus said that the Great Coroutines once stated:
> On Thu, May 29, 2014 at 11:21 AM, Andrew Starks <andrew.starks@trms.com> wrote:
> 
> > We use this for Visual Studio, which closes the the CMD window immediately
> > after closing. There are other ways to do it, of course...
> 
> Personally I want to see a -path and -cpath added to the stock Lua
> REPL for adding paths at `lua' invocation.  

  On Unix, you can do this:

	GenericUnixPrompt> LUA_PATH="./?.lua" LUA_CPATH="" lua

  Other systems not so much, so yes, I could see adding a "-path" and
"-cpath" to the Lua interpreter.

> It'd also be nice to have
> a -r for automatically doing a require().  

  That would be "lua -lmodule"

> You could just have a
> module called pause that calls io.read(), waiting for any character
> input.  Would also be nice to have a flag for executing a bit of Lua
> after the auto-require()'s but before the script run.  

  That would be "lua -e 'luacode' -i"

  All together then:

GenericUnixPrompt> lua -lorg.conman.table -e 'show=org.conman.table.show' -i
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> show(_G)
string          table: 0x2297380      
xpcall          function: 0x22969c0   
package         table: 0x2297b50      
tostring        function: 0x22968a0   
print           function: 0x2296a40   
os              table: 0x229a390      
unpack          function: 0x2296960   
require         function: 0x2298590   
getfenv         function: 0x2296430   
setmetatable    function: 0x22967e0   
next            function: 0x2296600   
assert          function: 0x2296310   
tonumber        function: 0x2296840   
io              table: 0x22999b0      
rawequal        function: 0x2296aa0   
collectgarbage  function: 0x2296370   
getmetatable    function: 0x22966c0   
module          function: 0x2298530   
rawset          function: 0x2296b60   
show            function: 0x229ecd0   
table           table: 0x2296bc0      
math            table: 0x229b7c0      
debug           table: 0x229c890      
pcall           function: 0x2296660   
org             table: 0x22a04b0      
newproxy        function: 0x2297560   
type            function: 0x2296900   
coroutine       table: 0x2297600      
_G              table: 0x22956b0      
select          function: 0x2295700   
gcinfo          function: 0x22963d0   
pairs           function: 0x22960b0   
rawget          function: 0x2296b00   
loadstring      function: 0x22965a0   
ipairs          function: 0x2296010   
_VERSION        "Lua 5.1"             
dofile          function: 0x2296480   
setfenv         function: 0x2296780   
load            function: 0x2296540   
error           function: 0x22964e0   
loadfile        function: 0x2296720   

  -spc (So most of what you want is already there)