Update of bug #15644 (project freeciv):

                  Status:                    None => Ready For Test         
             Assigned to:                    None => englabenny             
         Planned Release:                         => 2.3                    


Follow-up Comment #5:

Here is the patch, just in a slightly cleane up version again.

This /lua command is very very convenient when debugging and exploring the
lua runtime from the server prompt. If we implement normal_log or a similar
function, /lua can be conveniently used for debugging even from the client
(lua's print() output is only shown on server's standard output).

Anyone have comments on the command name? /lua or /script? This version of
the patch has the command as ALLOW_ADMIN.

Here is a very useful function for listing tables (namespaces, modules and
our API types are all tables):

(In one line to be pasted in as function def from the command line)

/lua function dir(T) if T == nil then T = _G end ; local sorted = {}; for key
in pairs(T) do table.insert(sorted, key) end ; table.sort(sorted); for index,
k in ipairs(sorted) do local v = T[k]; local src = ""; if type(v) ==
"function" then src = debug.getinfo(v).short_src end; print(string.format("%s
  \t%-30s\t%s", type(v), tostring(k), src)) end end

use like:

> /lua dir()


> /lua dir(City)

(file #8651)

Additional Item Attachment:

File name: 0001-Add-lua-server-command-to-evaluate-freeciv-script.patch
Size:4 KB


Reply to this item at:


  Meddelandet skickades via/av Gna!

Freeciv-dev mailing list

Reply via email to