• Output Value
    10 replies, posted
When the following ran a odd output occurs. Function: [lua] function p228legal1() p228legal3 = sql.QueryValue("SELECT status FROM statusj WHERE weaponname = 'p228'") umsg.Start("p228legal") umsg.String(p228legal3) print(p228legal3) umsg.End() end function usplegal1() usplegal3 = sql.QueryValue("SELECT status FROM statusj WHERE weaponname = 'usp'") umsg.Start("usplegal") umsg.String(usplegal3) print(usplegal1) umsg.End() end [/lua] Output: [lua] legal function: 0350DD48 function: 03482AB8 [/lua] Any clue why I would get that output?
You're printing a function (usplegal1 instead of upslegal3).
Oh, haha. When I was debugging I set it to p228legal3 and forgot to change it back. Anyways I get a similar error. Fucntion: [lua] function p228legal1() p228legal3 = sql.QueryValue("SELECT status FROM statusj WHERE weaponname = 'p228'") umsg.Start("p228legal") umsg.String(p228legal3) print(p228legal3) umsg.End() end function usplegal1() usplegal3 = sql.QueryValue("SELECT status FROM statusj WHERE weaponname = 'usp'") umsg.Start("usplegal") umsg.String(usplegal3) print(usplegal3) umsg.End() end [/lua] Output: [lua] legal function: 03469C30 [/lua] What you said(Use usplegal1 not usplegal3) wouldnt be right. usplegal3 is the Query ran into the database and usplegal1 is the actual function. [editline]10:05PM[/editline] I used usplegal1 instead of usplegal3 as you suggested and I got this output .. just to verify my above statement. [lua] legal function: 033E3C80 function: 0347C698 [/lua]
Is that all of your code? Because right now it should be printing either strings (from the query) or bools (false from an empty query).
Yes, It is all my code. It should be printing 'legal' or 'illegal' from the usermessage being sent from init.lua but it isn't and I have no clue why.
Well, it can't be all of the code since you aren't calling the functions anywhere :v: Check your code for 3 prints, and post them all.
Function for tables: [lua] function MakeWeapons() sql.Query("INSERT INTO statusj (`weaponname`, `status`)VALUES ('p228', 'legal')") sql.Query("INSERT INTO statusj (`weaponname`, `status`)VALUES ('usp', 'legal')") end [/lua] Here is this if it has anything little error in it I cant see.
... show me where you call the functions [B]p228legal1()[/B] and [B]usplegal1().[/B]
Also _nonSENSE you posted and I didnt see it. [lua] function GM:ShowSpare2(ply) p228legal1() usplegal1() end [/lua] Where its being called.
-snip- Ignore this.
So I think something is wrong with the Sql Tables([URL="http://www.facepunch.com/showpost.php?p=23880434&postcount=7"]Post #7[/URL]), but couldnt find anything. Any more suggestions/answers?
Sorry, you need to Log In to post a reply to this thread.