dostring function & nil value,.....
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

dostring function & nil value,.....

Started by Guibs, 31 January, 2004, 23:39:13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Guibs

Hi all,

Brrrr..... little problem, there....

Using > dostring(arg.."="..val) <
we can assign a value(val) to a parameter (arg),...

But,...
If we want that parameter get the ' nil value ' (to disable the parameter),, then... how can we get the nil result ???
I've tried:
---
val = nil
dostring(arg.."="..val)
---
doesn't work, lol... ^^

Thks in adance for your help... :)

l8tr,, ;)
-- Please,... don\'t ask help in Pm,...Forums are made for that, to help everyone & my Inbox pm will be safe,... Thks,,  :))  --
CB forum     /     CB Home page

pHaTTy

if you mean send to user the value equals nil use brackets val = "nil"

otherwise i dont understand what you mean  ?(
Resistance is futile!

Guibs

Hi there,,

well,.. it was to assign a nil value on a parameter/string,... :)
We have speak about on Msn,... but I take an example to be more clear,...
---
!set beertime on
---
then, if you use the function:
---
if arg2 == "on" then val = 1 end
dostring(arg.."="..val)
---
it gives:
"beertime" = 1
---
But i would like a way to assign a nil value to arg,... instead of using such function as:
---
if arg == "beertime" and arg2 == "off" then"beertime" = nil end
---
hope it's more clear...

l8tr,, ;)
-- Please,... don\'t ask help in Pm,...Forums are made for that, to help everyone & my Inbox pm will be safe,... Thks,,  :))  --
CB forum     /     CB Home page

c h i l l a

dunno maybe

dostring(arg.."=nil)

but else it clear that the error comes up, cause LUA will look for the variable val, and if you set a variable = nil then it is release = deleted, nada, nirvana what ever, its not there anymore.

NotRabidWombat

#4
The same way to do proper debugging.
Use: or "nil"

dostring(arg.."="..(val or "nil"));

if val is equal to nil the or condition kicks in and the non-nil string "nil" is returned in its place. This is very usefull when you want to test values/commands in scripts.

SendToAll(sBotName, val or "nil");

P.S. - I reread your comment and you appear to be using strings. Don't forget to do formating with the val that you are passing (make sure they are sending you some cooked data).

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

SMF spam blocked by CleanTalk