is this even an allowed activity around here? :eggbug:

good evening my good cohostizens? (oooooh, can we just say comrades?)

im procrastinating from debugging my not-so genuis code that my brain refuses to find the error in

it crashes with "expected array|table|buffer, got <struct 0x020DFB92C9B8>" somewhere in:

    (as-> it X
        (put-in X [:systems targetsystem :components entity-id :position :x] newx)
        (put-in X [:systems targetsystem :components entity-id :position :y] newy)
        (setdyn :instructiontable X)
        (printf " wtf is going on %q" X))

the "wtf.." print line isnt hit.

so i guess "it" needs to be inspected, i want to find out:

  • in what way has the instructiontables structure been mutated, which will bring us to
  • where it might have gotten in between the gears of our engine

sadly i havent arrived yet to a point where i can just open the debugger.. so i will just hit the trashbin button on my vscode console (though this time it even crashed down to the os prompt :O)

anyways, my current workfile is kind of a mess. i cant just [alt]+L ... i guess im missing block comments... sigh

let's see. i think it should be something like ...not a function since it shouldnt evaluate whatever you put in it...

(defmacro comment [&opt _])

aaaaaaaaaaaaaaaaaaaaaaand after writing this down i went into the documentation to hunt for something like this (remembering that i have read somewhere that there are no multiline comments)

THERE ARE NO MULTILINE COMMENTS
(comment &)

to my shock, after not long an investigation it has come to my knowledge (comment &) has existed since 2018 in the name of our lord whose name shallt not be spokenst

oh yeah lets think up a scp level cognitohazard, a creature whose name makes the author write funny until the name is written by accident or something. ok are we happy now? good. back to debugging

(printf ":entity %q :system %q" entity-id targetsystem)
(printf "it:keys:%q" (keys it))
(eachk k it 
    (printf "it:%q:%q" k (get-in it k)))

printed:

:entity :lenna :system :sprite
it:keys:@[:once :stack :systems :exit?]
it::once:nil
it::stack:nil
it::systems:nil
it::exit?:nil
"expected array|table|buffer, got <struct 0x01FD02344928>"

hmmm.... why nil in systems?

...

oh... i used get-in to get the value in it... but i only got one key, so i should either put the key in a tuple or use get...

of course i already [alt]+E'd the (exit) line ... look i hate to waste my processors time... kinda

yeah it doesnt make any sense, but torturing her with this malfunctioning code? come on.. have a heart for sillycone let me just assemble that env again real quick clicks the trash bin

ok, now i get more:

:entity :lenna :system :sprite
it:keys:@[:once :stack :systems :exit?]
it::once:@{:import-raylib @{:fn "(fn [] (import \".\\\\ffi-raylib\" :as rl))" :result @{ get-inbox @{:doc "(get-inbox)\n\nreturns a message from the supervisor channel" :source-map ("modules/myxle.janet" 16 1) :value <function get-inbox>} inbox-size @{:doc "(inbox-size)\n\nreturns the number of messages in the supervisor and parameterization channels" :source-map ("modules/myxle.janet" 10 1) :value <function inbox-size>} parameterization-channel @{:doc "threaded channel over which to send instructions and data to the worker" :source-map ("modules/myxle.janet" 6 1) :value <core/channel 0x02A79F218B30>} rl/BEIGE @{:private true} rl/BLACK @{:private true} rl/BLANK @{:private true} rl/BLUE @{:private true} rl/BROWN @{:private true} rl/BeginDrawing @{:private true} rl/ClearBackground @{:private true} rl/CloseWindow @{:private true} rl/DARKBLUE @{:private true} rl/DARKBROWN @{:private true} rl/DARKGRAY @{:private true} rl/DARKGREEN @{:private true} rl/DARKPURPLE @{:private true} rl/DrawText @{:private true} rl/DrawTextEx @{:private true} rl/DrawTexture @{:private true} rl/EndDrawing @{:private true} rl/GOLD @{:private true} rl/GRAY @{:private true} rl/GREEN @{:private true} rl/GenImageCellular @{:private true} rl/GetKeyPressed @{:private true} rl/GetMouseX @{:private true} rl/GetMouseY @{:private true} rl/GetScreenHeight @{:private true} rl/GetScreenWidth @{:private true} rl/ImageDither @{:private true} ...}} :init-raylib @{:fn "(fn init-raylib [] (let [it (dyn :instructiontable) oi (get-in it [:once :init-raylib :result] {:window {:fps 60 :size {:x 800 :y 600} :title \"hello raylib, this is janet via ffi\"}}) {:window {:fps fps :size {:x x :y y} :title title}} oi] (rl/init-window x y title) (rl/set-target-fps fps) oi))" :result {:window {:fps 60 :size {:x 800 :y 600} :title "hello raylib, this is janet via ffi"}}} :lenna @{:fn "(fn load-lenna [] (let [image (rl/load-image-1 \"D:\\\\Projects\\\\lain\\\\janet\\\\jaylib\\\\test\\\\lenna.png\") image-dithered (rl/image-dither image 4 4 4 4)] (rl/load-texture-from-image image-dithered)))" :result (3 512 512 1 6)}}
it::stack:@{:exit @["(do (pp \"unloading texture\") (rl-ffi/unload-texture lenna-t))" "(do (pp \"closing window\") (rl-ffi/close-window))"] :post @["(do (rl/end-drawing))"] :pre @["(do (rl/begin-drawing))" "(do (rl/clear-background [0 0 
0 255]))"]}
it::systems:@{:screenpositionscrambler @{:components @{:lenna {:entity :lenna :system :sprite}} :fn <function screenpositionscrambler> :instr "(fn screenpositionscrambler [component] (when-let [it (dyn :instructiontable) _ (do (printf \"move along now %q\" component) true) {:x maxx :y maxy} (get-in it [:once :init-raylib :result :window :size]) _ (do (printf \":x %q :y %q\" maxx maxy) true) newx (math/rng-int (math/rng (os/time)) maxx) _ (do (printf \"newx %q\" newx) true) newy (math/rng-int (math/rng (os/time)) maxy) _ (do (printf \"newy %q\" newy) true) {:entity entity-id :system targetsystem} component] (printf \":entity %q :system %q\" entity-id targetsystem) (printf \"it:keys:%q\" (keys it)) (eachk k it (printf \"it:%q:%q\" k (get it k))) (as-> it X (put-in X [:systems targetsystem :components entity-id :position :x] newx) (put-in X [:systems targetsystem :components entity-id :position :y] newy) (setdyn :instructiontable X) (printf \" wtf is going on %q\" X)) (printf \"done\")))"} :sprite @{:components @{:lenna { :entity :lenna :position {:x 0 :y 0} :texture (3 512 512 1 6) :tint @[255 255 255 255]}} :fn <function sprite> :instr "(fn sprite [component] (when-let [{:entity entity-id :position {:x x :y y} :texture texture :tint tint} component] (rl/draw-texture texture x y tint)))"}}
it::exit?:false
"expected array|table|buffer, got <struct 0x02A7A4B7B4B8>"

i'll have to brood on that for a bit, ill continue in a new post sorry if this was not interesting or entertaining to you, idk what this is, im just keeping notes here is what im trying to say i guess


You must log in to comment.