LCE : Love Callbacks Enforcer

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
TsT
Party member
Posts: 161
Joined: Thu Sep 25, 2008 7:04 pm
Location: France
Contact:

LCE : Love Callbacks Enforcer

Post by TsT »

Introduction

Have you already read post like "do not call draw functions inside love.update" ?
I already read it ! I think lot of beginners do this kind of mistakes.
Do you think "I'm not a beginner, I don't do this kind of things". Are you really sure ?
What are you call in love.update ?

The goal of the project

Provide a easy to setup way to check if you do bad things (define by yourself and/or per the love policy).
I quickly setup a config for demonstration.
It's not strict, it not raise error, it only print message.

How it run

Technically,
it use the debug.sethook to see function's calls and function's returns.
When it call in a function (it change the current context if the function is defined in config)
When a function is call, it check if this function is watched. if yes it check if it allowed in the current context.

How to use it

You just need to put at the beginning of your love.load function in "main.lua" file :

Code: Select all

require("lce-love-config")
To do

- See if it's normal to have only one message printed for call of print in update
- Show the full call name like "love.graphics.print" instead of "print"
- Forward the debug info table to the handler
- Show more info like like line number in usual error message
- I need to check more with existing love game to see if there is not bug.
- Need to define more the love policy.
- Think about a way to detect callback change (to add missing callbacks)

Download
lce-0.1.0-20110520.love
LCE demo v0.1.0
(3.32 KiB) Downloaded 110 times
My projects current projects : dragoon-framework (includes lua-newmodule, lua-provide, lovemodular, , classcommons2, and more ...)
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests