« Module:LxTerm » : différence entre les versions

De Adadov.net wiki
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 1 : Ligne 1 :
local p = {}
local p = {}


function p.main(frame)
local text = [[command \
local text = frame.args.text
command2
command3 \
command4]]
 
function p.main(text)
--local text = frame.args.text
local result = ""
local result = ""
print(tostring(text))
for line in text:gmatch("[^\n]+") do
for line in text:gmatch("[^\n]+") do
--print(line)
--print(line)
Ligne 12 : Ligne 16 :
end
end
end
end
return text
end
end


return p
return p

Version du 5 février 2015 à 18:44

Documentation icon Documentation Module[voir] [éditer] [historique] [purger]

Ce module implémente {{LxTerm}}, il met en forme les lignes de commande et ajoute les prompt.

{{#invoke:LxTerm|main|cmdnum=1|user=root|text=test \
test2}}

Erreur Lua à la ligne 12 : attempt to call method 'gmatch' (a nil value).

{{#invoke:LxTerm|main|cmdnum=1|user=root|text=test
test2}}

Erreur Lua à la ligne 12 : attempt to call method 'gmatch' (a nil value).

{{#invoke:LxTerm|main|user=nobody|text=test2}}

Erreur Lua à la ligne 12 : attempt to call method 'gmatch' (a nil value).

{{#invoke:LxTerm|main|text=test3}}

Erreur Lua à la ligne 12 : attempt to call method 'gmatch' (a nil value).

local p = {}

local text = [[command \
command2
command3 \
command4]]

function p.main(text)
	--local text = frame.args.text
	local result = ""
	
	for line in text:gmatch("[^\n]+") do
		--print(line)
		if line:gmatch("%\\n") then
			--print(line)
		end
	end
	return text
end

return p