Page 3 of 3
Re: A console thing
Posted: Thu Oct 16, 2008 9:35 pm
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!
Re: A console thing
Posted: Thu Oct 16, 2008 9:48 pm
by nightvenom
:O ty lol.
Re: A console thing
Posted: Mon Feb 09, 2009 2:38 pm
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
Re: A console thing
Posted: Thu Feb 26, 2009 4:18 pm
by philnelson
I love this console library so much that I would marry it if our society's puritanical laws did not forbid it.
Re: A console thing
Posted: Sat Feb 28, 2009 2:04 pm
by Skofo
Is this under any license?
Re: A console thing
Posted: Sat Feb 28, 2009 6:39 pm
by qubodup
Skofo wrote:Is this under any license?
did you look inside the archive?
Re: A console thing
Posted: Mon Mar 23, 2009 11:06 pm
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,