Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Commit

Permalink
fixed a minor issue in ShinyLua
Browse files Browse the repository at this point in the history
  • Loading branch information
aidinabedi committed Dec 25, 2009
1 parent 335b396 commit e2f1766
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
25 changes: 18 additions & 7 deletions ShinyLua/include/ShinyLua.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#include "Shiny.h"

typedef struct lua_State lua_State;

SHINY_EXPORT int luaopen_shiny(lua_State *L);
*/

#include "Shiny.h"

typedef struct lua_State lua_State;

extern "C" {

SHINY_EXPORT int luaopen_ShinyLua(lua_State *L);

SHINY_EXPORT int ShinyLua_update(lua_State *L);
SHINY_EXPORT int ShinyLua_clear(lua_State *L);
SHINY_EXPORT int ShinyLua_damping(lua_State *L);
SHINY_EXPORT int ShinyLua_enabled(lua_State *L);
SHINY_EXPORT int ShinyLua_output(lua_State *L);
SHINY_EXPORT int ShinyLua_treeString(lua_State *L);
SHINY_EXPORT int ShinyLua_flatString(lua_State *L);
}
14 changes: 7 additions & 7 deletions ShinyLua/src/ShinyLua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ int ShinyLua_damping(lua_State *L) {
if (lua_gettop(L) == 1) {
float damping = (float) luaL_checknumber(L, -1);
PROFILE_SET_DAMPING(damping);
return 0;

} else {
lua_pushnumber(L, PROFILE_GET_DAMPING());
return 1;
}

return 0;
}


Expand All @@ -198,12 +198,12 @@ int ShinyLua_enabled(lua_State *L) {
if (lua_gettop(L) == 1) {
is_running = lua_isboolean(L, -1)? lua_toboolean(L, -1) : luaL_checkint(L, -1);
lua_sethook(L, callhook, is_running? (LUA_MASKCALL | LUA_MASKRET) : 0, 0);
return 0;

} else {
lua_pushboolean(L, is_running);
return 1;
}

return 0;
}


Expand All @@ -225,21 +225,21 @@ int ShinyLua_output(lua_State *L) {

int ShinyLua_treeString(lua_State *L) {
lua_pushstring(L, PROFILE_GET_TREE_STRING().c_str());
return 0;
return 1;
}


//-----------------------------------------------------------------------------

int ShinyLua_flatString(lua_State *L) {
lua_pushstring(L, PROFILE_GET_FLAT_STRING().c_str());
return 0;
return 1;
}


//-----------------------------------------------------------------------------

int luaopen_profiler(lua_State *L) {
int luaopen_ShinyLua(lua_State *L) {
const luaL_reg funcs[] = {
{ "update", ShinyLua_update },
{ "clear", ShinyLua_clear },
Expand Down

0 comments on commit e2f1766

Please sign in to comment.