LUA Error "wrong argument type" when calling no arg function

Post Reply
barinelg
Posts: 2
Joined: Thu Feb 04, 2010 3:36 am

LUA Error "wrong argument type" when calling no arg function

Post by barinelg »

I am having a minor problem when it comes to creating a function in Lua, and then calling it later.

The general idea is this :

Code: Select all

function createConsole()
	createMiniConsole("console_test", 100, 100, 100, 100)
	setBackgroundColor("console_test", 0, 125, 125)
	setMiniConsoleFontSize("console_test", 8)
	setWindowWrap("console_test", 40)
	setTextFormat("console_test", 0,35,255,50,50,50,0,0,0)
end
When I try to call createConsole later, all I should have to do is put

Code: Select all

createConsole()
But when I do this, I get the following error:
LUA: ERROR running script MiniC (Alias2) ERROR:Lua error:wrong argument type

This doesn't quite make sense to me. The only thing in the alias is "createConsole()".

Any ideas as to why I'm getting an argument error, when the function has no arguments and nothing is attempting to pass any to it? I know this should work, because I have done something similar with another function and there were no errors.

Thanks in advance for any information!

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: LUA Error "wrong argument type" when calling no arg function

Post by Vadi »

It would mean that one of the miniConsole functions you're using inside that function is either giving the wrong amount of arguments of the wrong type of arguments.

Sorry that it's not really informative as to which function and what argument - hope to rectify this later. For now, check the functions one by one to see which is being used wrongly.

barinelg
Posts: 2
Joined: Thu Feb 04, 2010 3:36 am

Re: LUA Error "wrong argument type" when calling no arg function

Post by barinelg »

Thanks for the reply. It appears that the function setBackgroundColor() requires 5 arguments, where I was giving only 4. I wasn't expecting the error to be in the function, but it appears to be working now.

Thanks again!

Post Reply