boolean return nil

Hi all,

My issue is simple but I can’t understand why when I do simple code like:

player.jump = false print(player.jump) Output: nil

print return nil rather than false

but if I’m setting the boolean to true, print return logically true

I point out I’m using a library to use metamethods stuff, maybe come from here but I doubt, I was using another library in my last projet and I don’t remember that the print return nil with negative boolean value

An explication ?

thanks 

My output is false when testing your code, assuming I create a player variable first. Can you give a bit more of your code? How are you declaring the “player” variable?

local owl = require "owl" -- create a new class local Dog = owl.class{ name="DogClass", image="dog.png", width="100", height="100"} function Dog:init( params ) local params = params or {} for k,v in pairs( params ) do self[k] = v end self.params = params end local params = { name = "rox", size = "medium", jump\_false = false, jump\_true = true } --create a new instance of "DogClass" local black\_dog = owl.instance{ from=Dog, id = "black\_dog", params = params } print(black\_dog.name, black\_dog.jump\_false, black\_dog.jump\_true, "boolean")  Output : rox nil true boolean

My code is pretty simple because I’m testing this new library:Owl made by jonbeebe, you can find it code here: https://github.com/pickerel/owl/blob/master/owl.lua

Even with his sample, when I print a boolean value from an instance, it return me nil excepted when I use the proxy( property_call_back ). to update value but if I don’t want to use it , I’m stuck…

So the problem come from the library, I’m still looking through it to find out why this happen but it’s hard.

thanks to your help

My output is false when testing your code, assuming I create a player variable first. Can you give a bit more of your code? How are you declaring the “player” variable?

local owl = require "owl" -- create a new class local Dog = owl.class{ name="DogClass", image="dog.png", width="100", height="100"} function Dog:init( params ) local params = params or {} for k,v in pairs( params ) do self[k] = v end self.params = params end local params = { name = "rox", size = "medium", jump\_false = false, jump\_true = true } --create a new instance of "DogClass" local black\_dog = owl.instance{ from=Dog, id = "black\_dog", params = params } print(black\_dog.name, black\_dog.jump\_false, black\_dog.jump\_true, "boolean")  Output : rox nil true boolean

My code is pretty simple because I’m testing this new library:Owl made by jonbeebe, you can find it code here: https://github.com/pickerel/owl/blob/master/owl.lua

Even with his sample, when I print a boolean value from an instance, it return me nil excepted when I use the proxy( property_call_back ). to update value but if I don’t want to use it , I’m stuck…

So the problem come from the library, I’m still looking through it to find out why this happen but it’s hard.

thanks to your help