From 1bcf5d3ab366002e8000656b566340c3efd756af Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 23 May 2009 14:08:58 +0000 Subject: new ULuaUtils procedure: lua_PushBinInt new functions in ScreenSing lua module ScreenSing.GetSettings ScreenSing.SetSettings 3 new settings in UScreenSing that needs to be implemented LyrcsVisible, NotesVisible and PlayerEnabled git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1769 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Lua/src/lua/ULuaUtils.pas | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'Lua/src/lua/ULuaUtils.pas') diff --git a/Lua/src/lua/ULuaUtils.pas b/Lua/src/lua/ULuaUtils.pas index de3bd15f..4ac1d80a 100644 --- a/Lua/src/lua/ULuaUtils.pas +++ b/Lua/src/lua/ULuaUtils.pas @@ -42,6 +42,13 @@ uses ULua, ULuaCore; does not pop anything } function Lua_ToBinInt(L: PLua_State; idx: Integer): Integer; +{ converts an integer with the value: + 0b11001 + to a lua table with a structure like: + * = 1 , * = 4 , * = 5 + and pushed the table onto the stack } +procedure Lua_PushBinInt(L: PLua_State; BinInt: Integer); + { returns plugin that is the owner of the given state may raise a lua error if the parent id is not found in states registry, if state owner does not exists @@ -88,6 +95,30 @@ begin end; end; +{ converts an integer with the value: + 0b11001 + to a lua table with a structure like: + * = 1 , * = 4 , * = 5 + and pushed the table onto the stack } +procedure Lua_PushBinInt(L: PLua_State; BinInt: Integer); +var + I, Index: Integer; +begin + lua_newTable(L); + + + Index := 1; //< lua starts w/ index 1 + for I := 0 to 31 do + if (BinInt and (1 shl I) <> 0) then + begin + lua_pushInteger(L, Index); + lua_pushInteger(L, I); + lua_settable(L, -3); + + Inc(Index); + end; +end; + { returns plugin that is the owner of the given state may raise a lua error if the parent id is not found in states registry, if state owner does not exists -- cgit v1.2.3