A console thing

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
TsT
Party member
Posts: 161
Joined: Thu Sep 25, 2008 7:04 pm
Location: France
Contact:

Re: A console thing

Post by TsT »

This your ConsoleTest.love modified.
Summary of change:
- Show/hide console are totally manage outside of Console.lua (press F1 to toggle)
- You can register command that will be use in console.
- One of them are named "lua". It evaluate/execute the rest of the line as lua code (like previous default behavior)
- I have replace the Console:printv by the BlackNecro' s one with some personnal change (to show exactly the type of key/value)
- Some other things that I forgot.

Have fun!
Attachments
consoletest_bytst.love
Modified version of Original zeedy's ConsoleTest.love
(31.68 KiB) Downloaded 212 times
My projects current projects : dragoon-framework (includes lua-newmodule, lua-provide, lovemodular, , classcommons2, and more ...)
User avatar
nightvenom
Prole
Posts: 36
Joined: Sat Aug 16, 2008 3:07 pm

Re: A console thing

Post by nightvenom »

:O ty lol.
User avatar
counterfactual_jones
Prole
Posts: 24
Joined: Mon Feb 09, 2009 10:14 am

Re: A console thing

Post by counterfactual_jones »

TsT wrote:This your ConsoleTest.love modified.
I'm getting lots of "bad argument #1 to pairs" when I use printv. You should detect such conditions yourself and give a slightly less jarring error message than the Love error message. Like:

Code: Select all

function Console:printv(inTable,scope)
++ if type(inTable) != "table" then self:print("I am error!"); return end
   scope = scope or 0
   local spacer = string.rep(" ",scope*3) or ""
   for var, value in pairs(inTable) do
      if type(value) == "table" then
         self:print(spacer..tostring(var).." = ".. tostring(value))
         self:printv(value, scope + 1)
      else
         local printvar = type(var) == "string" and '"'..tostring(var)..'"' or tostring(var)
         local printval = type(value) == "string" and '"'..tostring(value)..'"' or tostring(value)
         self:print(spacer .. printvar .. " = " .. printval)
      end
   end
end
philnelson
Prole
Posts: 48
Joined: Sun Feb 01, 2009 3:32 am

Re: A console thing

Post by philnelson »

I love this console library so much that I would marry it if our society's puritanical laws did not forbid it.
User avatar
Skofo
Party member
Posts: 146
Joined: Mon Dec 22, 2008 10:55 pm

Re: A console thing

Post by Skofo »

Is this under any license?
Working on: Viator
Need a 64-bit Debian package for LÖVE? Here it is!
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: A console thing

Post by qubodup »

Skofo wrote:Is this under any license?
did you look inside the archive?
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
User avatar
TsT
Party member
Posts: 161
Joined: Thu Sep 25, 2008 7:04 pm
Location: France
Contact:

Re: A console thing

Post by TsT »

counterfactual_jones wrote:
TsT wrote:This your ConsoleTest.love modified.
I'm getting lots of "bad argument #1 to pairs" when I use printv. You should detect such conditions yourself and give a slightly less jarring error message than the Love error message. Like:

Code: Select all

++ if type(inTable) != "table" then self:print("I am error!"); return end
You have rigth. Thanks for you fix!
Just another fix : (I got a error) I think the "!=" operator is "~=" in lua, isn't it ?

Code: Select all

   if type(inTable) ~= "table" then
      self:print("Error: This variable is not a table.")
      return
   end
Best Regards,
Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests